-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into json-plus
- Loading branch information
Showing
641 changed files
with
5,797 additions
and
698 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
benchmarks/Neo.Benchmarks/Persistence/Bechmarks_ReadOnlyStoreView.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
benchmarks/Neo.Benchmarks/SmartContract/Benchmarks.StorageKey.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
benchmarks/Neo.Extensions.Benchmarks/Benchmark.ByteArrayComparer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
benchmarks/Neo.Extensions.Benchmarks/Benchmark.StringExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (C) 2015-2025 The Neo Project. | ||
// | ||
// Benchmark_JBoolean.cs file belongs to the neo project and is free | ||
// software distributed under the MIT software license, see the | ||
// accompanying file LICENSE in the main directory of the | ||
// repository or http://www.opensource.org/licenses/mit-license.php | ||
// for more details. | ||
// | ||
// Redistribution and use in source and binary forms with or without | ||
// modifications are permitted. | ||
|
||
using BenchmarkDotNet.Attributes; | ||
|
||
namespace Neo.Json.Benchmarks | ||
{ | ||
[MemoryDiagnoser] | ||
[CsvMeasurementsExporter] | ||
[MarkdownExporter] | ||
public class Benchmark_JBoolean | ||
{ | ||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. | ||
private JBoolean _jFalse; | ||
private JBoolean _jTrue; | ||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
_jFalse = new JBoolean(); | ||
_jTrue = new JBoolean(true); | ||
} | ||
|
||
[Benchmark] | ||
public void TestAsNumber() | ||
{ | ||
_ = _jFalse.AsNumber(); | ||
_ = _jTrue.AsNumber(); | ||
} | ||
|
||
[Benchmark] | ||
public void TestConversionToString() | ||
{ | ||
_ = _jTrue.ToString(); | ||
_ = _jFalse.ToString(); | ||
} | ||
} | ||
} | ||
|
||
/// BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.2605) | ||
/// 13th Gen Intel Core i9-13900H, 1 CPU, 20 logical and 14 physical cores | ||
/// .NET SDK 9.0.101 | ||
/// [Host] : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2 [AttachedDebugger] | ||
/// DefaultJob: .NET 9.0.0(9.0.24.52809), X64 RyuJIT AVX2 | ||
/// | ||
/// | Method | Mean | Error | StdDev | Median | Gen0 | Allocated | | ||
/// |----------------------- |-----------:|----------:|----------:|-----------:|-------:|----------:| | ||
/// | TestAsNumber | 0.0535 ns | 0.0233 ns | 0.0239 ns | 0.0427 ns | - | - | | ||
/// | TestConversionToString | 17.8216 ns | 0.2321 ns | 0.1938 ns | 17.7613 ns | 0.0051 | 64 B | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (C) 2015-2025 The Neo Project. | ||
// | ||
// Benchmark_JNumber.cs file belongs to the neo project and is free | ||
// software distributed under the MIT software license, see the | ||
// accompanying file LICENSE in the main directory of the | ||
// repository or http://www.opensource.org/licenses/mit-license.php | ||
// for more details. | ||
// | ||
// Redistribution and use in source and binary forms with or without | ||
// modifications are permitted. | ||
|
||
using BenchmarkDotNet.Attributes; | ||
|
||
namespace Neo.Json.Benchmarks | ||
{ | ||
[MemoryDiagnoser] | ||
[CsvMeasurementsExporter] | ||
[MarkdownExporter] | ||
public class Benchmark_JNumber | ||
{ | ||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. | ||
private JNumber _maxInt; | ||
private JNumber _zero; | ||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
_maxInt = new JNumber(JNumber.MAX_SAFE_INTEGER); | ||
_zero = new JNumber(0); | ||
} | ||
|
||
[Benchmark] | ||
public void TestAsBoolean() | ||
{ | ||
_ = _maxInt.AsBoolean(); | ||
_ = _zero.AsBoolean(); | ||
} | ||
|
||
[Benchmark] | ||
public void TestAsString() | ||
{ | ||
_ = _maxInt.AsString(); | ||
} | ||
} | ||
} | ||
|
||
/// BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.2605) | ||
/// 13th Gen Intel Core i9-13900H, 1 CPU, 20 logical and 14 physical cores | ||
/// .NET SDK 9.0.101 | ||
/// [Host] : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2 [AttachedDebugger] | ||
/// DefaultJob: .NET 9.0.0(9.0.24.52809), X64 RyuJIT AVX2 | ||
/// | ||
/// | Method | Mean | Error | StdDev | Gen0 | Allocated | | ||
/// |-------------- |----------:|----------:|----------:|-------:|----------:| | ||
/// | TestAsBoolean | 2.510 ns | 0.0603 ns | 0.0564 ns | - | - | | ||
/// | TestAsString | 87.000 ns | 1.2230 ns | 1.1440 ns | 0.0044 | 56 B | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (C) 2015-2025 The Neo Project. | ||
// | ||
// Benchmark_JObject.cs file belongs to the neo project and is free | ||
// software distributed under the MIT software license, see the | ||
// accompanying file LICENSE in the main directory of the | ||
// repository or http://www.opensource.org/licenses/mit-license.php | ||
// for more details. | ||
// | ||
// Redistribution and use in source and binary forms with or without | ||
// modifications are permitted. | ||
|
||
using BenchmarkDotNet.Attributes; | ||
|
||
namespace Neo.Json.Benchmarks | ||
{ | ||
[MemoryDiagnoser] | ||
[CsvMeasurementsExporter] | ||
[MarkdownExporter] | ||
public class Benchmark_JObject | ||
{ | ||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. | ||
private JObject _alice; | ||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
_alice = new JObject | ||
{ | ||
["name"] = "Alice", | ||
["age"] = 30 | ||
}; | ||
} | ||
|
||
[Benchmark] | ||
public void TestAddProperty() | ||
{ | ||
_alice["city"] = "New York"; | ||
} | ||
|
||
[Benchmark] | ||
public void TestClone() | ||
{ | ||
_ = _alice.Clone(); | ||
} | ||
|
||
[Benchmark] | ||
public void TestParse() | ||
{ | ||
JObject.Parse("{\"name\":\"John\", \"age\":25}"); | ||
} | ||
} | ||
} | ||
|
||
/// BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.2605) | ||
/// 13th Gen Intel Core i9-13900H, 1 CPU, 20 logical and 14 physical cores | ||
/// .NET SDK 9.0.101 | ||
/// [Host] : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2 [AttachedDebugger] | ||
/// DefaultJob: .NET 9.0.0(9.0.24.52809), X64 RyuJIT AVX2 | ||
/// | ||
/// | Method | Mean | Error | StdDev | Gen0 | Allocated | | ||
/// |---------------- |----------:|---------:|---------:|-------:|----------:| | ||
/// | TestAddProperty | 11.35 ns | 0.135 ns | 0.119 ns | 0.0019 | 24 B | | ||
/// | TestClone | 123.72 ns | 1.898 ns | 1.585 ns | 0.0503 | 632 B | | ||
/// | TestParse | 240.81 ns | 2.974 ns | 2.322 ns | 0.0577 | 728 B | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (C) 2015-2025 The Neo Project. | ||
// | ||
// Benchmark_JPath.cs file belongs to the neo project and is free | ||
// software distributed under the MIT software license, see the | ||
// accompanying file LICENSE in the main directory of the | ||
// repository or http://www.opensource.org/licenses/mit-license.php | ||
// for more details. | ||
// | ||
// Redistribution and use in source and binary forms with or without | ||
// modifications are permitted. | ||
|
||
using BenchmarkDotNet.Attributes; | ||
|
||
namespace Neo.Json.Benchmarks | ||
{ | ||
[MemoryDiagnoser] | ||
[CsvMeasurementsExporter] | ||
[MarkdownExporter] | ||
public class Benchmark_JPath | ||
{ | ||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. | ||
private JObject _json; | ||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
_json = new JObject | ||
{ | ||
["store"] = new JObject | ||
{ | ||
["book"] = new JArray | ||
{ | ||
new JObject { ["title"] = "Book A", ["price"] = 10.99 }, | ||
new JObject { ["title"] = "Book B", ["price"] = 15.50 } | ||
} | ||
} | ||
}; | ||
} | ||
|
||
[Benchmark] | ||
public void TestJsonPathQuery() | ||
{ | ||
_json.JsonPath("$.store.book[*].title"); | ||
} | ||
} | ||
} | ||
|
||
/// BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.2605) | ||
/// 13th Gen Intel Core i9-13900H, 1 CPU, 20 logical and 14 physical cores | ||
/// .NET SDK 9.0.101 | ||
/// [Host] : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2 [AttachedDebugger] | ||
/// DefaultJob : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2 | ||
/// | ||
/// | Method | Mean | Error | StdDev | Gen0 | Allocated | | ||
/// |------------------ |---------:|---------:|--------:|-------:|----------:| | ||
/// | TestJsonPathQuery | 679.7 ns | 11.84 ns | 9.89 ns | 0.1869 | 2.3 KB | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright (C) 2015-2025 The Neo Project. | ||
// | ||
// Benchmark_JString.cs file belongs to the neo project and is free | ||
// software distributed under the MIT software license, see the | ||
// accompanying file LICENSE in the main directory of the | ||
// repository or http://www.opensource.org/licenses/mit-license.php | ||
// for more details. | ||
// | ||
// Redistribution and use in source and binary forms with or without | ||
// modifications are permitted. | ||
|
||
using BenchmarkDotNet.Attributes; | ||
|
||
namespace Neo.Json.Benchmarks | ||
{ | ||
[MemoryDiagnoser] | ||
[CsvMeasurementsExporter] | ||
[MarkdownExporter] | ||
public class Benchmark_JString | ||
{ | ||
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. | ||
private JString _testString; | ||
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable. | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
_testString = new JString("hello world"); | ||
} | ||
|
||
[Benchmark] | ||
public void TestLength() | ||
{ | ||
_ = _testString.Value.Length; | ||
} | ||
|
||
[Benchmark] | ||
public void TestConversionToString() | ||
{ | ||
_ = _testString.ToString(); | ||
} | ||
|
||
[Benchmark] | ||
public void TestClone() | ||
{ | ||
_ = _testString.Clone(); | ||
} | ||
} | ||
} | ||
|
||
///BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.2605) | ||
///13th Gen Intel Core i9-13900H, 1 CPU, 20 logical and 14 physical cores | ||
///.NET SDK 9.0.101 | ||
/// [Host] : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2 [AttachedDebugger] | ||
/// DefaultJob : .NET 9.0.0 (9.0.24.52809), X64 RyuJIT AVX2 | ||
/// | ||
///| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated | | ||
///|----------------------- |-----------:|----------:|----------:|-------:|-------:|----------:| | ||
///| TestLength | 0.0050 ns | 0.0044 ns | 0.0041 ns | - | - | - | | ||
///| TestConversionToString | 76.8631 ns | 1.0699 ns | 1.2737 ns | 0.0695 | 0.0001 | 872 B | | ||
///| TestClone | 0.0233 ns | 0.0104 ns | 0.0087 ns | - | - | - | |
Oops, something went wrong.