Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neo.json.benchmarks #3673

Merged
merged 13 commits into from
Jan 17, 2025
Merged

Conversation

chenzhitong
Copy link
Member

🚀 Performance Benchmarks for Neo.Json Components

📖 Description
This pull request adds comprehensive performance benchmarks for the Neo.Json library using BenchmarkDotNet. The benchmarks compare core operations of Neo.Json with Newtonsoft.Json to evaluate performance differences in serialization and deserialization tasks.

📦 Changes Included

  • New Benchmark Files Added:
    • Benchmark_OrderedDictionary.cs
    • Benchmark_JBoolean.cs
    • Benchmark_JNumber.cs
    • Benchmark_JObject.cs
    • Benchmark_JPath.cs
    • Benchmark_JString.cs
    • Benchmark_JsonDeserialize.cs
  • BenchmarkDotNet Integration:
    • Added CSV and Markdown exporters.
    • Performance measurements for basic operations such as adding, cloning, parsing, and querying.

🎯 Motivation

  • Provide a consistent performance evaluation for Neo.Json.
  • Identify potential performance bottlenecks.
  • Ensure high-performance standards in the library.

✅ How to Run
Run the benchmarks using:

dotnet run -c Release

📈 Example Output

Method Mean Error StdDev Gen0 Gen1 Gen2 Allocated
Newtonsoft_Deserialize 627.4 us 9.10 us 8.07 us 79.1016 53.7109 - 978.52 KB
NeoJson_Deserialize 635.8 us 41.54 us 122.49 us 73.2422 36.1328 36.1328 919.45 KB

📦 Impact

  • No breaking changes.
  • Added BenchmarkDotNet and Newtonsoft.Json as dependencies for benchmarking purposes only.

Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RpcTestCases.json is used?

@chenzhitong
Copy link
Member Author

RpcTestCases.json is used?

Yes in this file Benchmark_JsonDeserialize.cs

@chenzhitong
Copy link
Member Author

Wait a minute, I should change the comments to English.

shargon
shargon previously approved these changes Jan 16, 2025
@shargon
Copy link
Member

shargon commented Jan 17, 2025

The header should be updated to 2025 @superboyiii

@shargon shargon merged commit af0770a into neo-project:master Jan 17, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants