Skip to content

Neo.json.benchmarks#3673

Merged
shargon merged 13 commits intoneo-project:masterfrom
chenzhitong:Neo.Json.Benchmarks
Jan 17, 2025
Merged

Neo.json.benchmarks#3673
shargon merged 13 commits intoneo-project:masterfrom
chenzhitong:Neo.Json.Benchmarks

Conversation

@chenzhitong
Copy link
Contributor

🚀 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
Contributor Author

RpcTestCases.json is used?

Yes in this file Benchmark_JsonDeserialize.cs

@chenzhitong
Copy link
Contributor 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
Jim8y added a commit to Jim8y/neo that referenced this pull request Jan 31, 2025
* master: (43 commits)
  Fix `GetAndChange` warnings (neo-project#3702)
  `Murmur3` should not be cryptographic hash algorithm (neo-project#3668)
  Test: add tests for native contract id (neo-project#3697)
  Update nugets (neo-project#3692)
  [Core P2P] fix the bug (neo-project#3695)
  Add hardfork HF_Echidna (neo-project#3454)
  Fix: add lock for RocksDbStore.Snapshot to keep same behavior as MemoryStore and LevelDbStore (neo-project#3689)
  Nullable rocks db (neo-project#3686)
  Nullable leveldb (neo-project#3685)
  Enforcement Compiler Warnings (neo-project#3687)
  [`Update`] Dotnet & Compiler Version (neo-project#3684)
  [`Add`]: LevelDB Benchmarks (neo-project#3667)
  [`Fix`]: Behavior when `keyPrefix` is null in different `IStore.Seek` impls. (neo-project#3682)
  Improve calculatenetworkfee (neo-project#3674)
  more 2025 (neo-project#3678)
  Nullable in Storage classes (neo-project#3670)
  readonly (neo-project#3676)
  [Fix] Set max entries for `VerifyProof` in `statePlugin` (neo-project#3675)
  Neo.json.benchmarks (neo-project#3673)
  Happy new year 2025 (neo-project#3677)
  ...

# Conflicts:
#	src/Neo/Neo.csproj
#	src/Neo/ProtocolSettings.cs
#	src/Neo/SmartContract/ApplicationEngine.cs
#	src/Neo/SmartContract/Native/NeoToken.cs
#	src/Neo/SmartContract/Native/RoleManagement.cs
#	tests/Neo.UnitTests/SmartContract/Native/UT_NativeContract.cs
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