Skip to content

Commit

Permalink
Merge branch 'master' into json-plus
Browse files Browse the repository at this point in the history
  • Loading branch information
cschuchardt88 authored Jan 17, 2025
2 parents 3c15c6f + 39e4fe1 commit ebb00e7
Show file tree
Hide file tree
Showing 641 changed files with 5,797 additions and 698 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ dotnet_naming_symbols.all_members.applicable_kinds = *

dotnet_naming_style.pascal_case_style.capitalization = pascal_case

file_header_template = Copyright (C) 2015-2024 The Neo Project.\n\n{fileName} file belongs to the neo project and is free\nsoftware distributed under the MIT software license, see the\naccompanying file LICENSE in the main directory of the\nrepository or http://www.opensource.org/licenses/mit-license.php\nfor more details.\n\nRedistribution and use in source and binary forms with or without\nmodifications are permitted.
file_header_template = Copyright (C) 2015-2025 The Neo Project.\n\n{fileName} file belongs to the neo project and is free\nsoftware distributed under the MIT software license, see the\naccompanying file LICENSE in the main directory of the\nrepository or http://www.opensource.org/licenses/mit-license.php\nfor more details.\n\nRedistribution and use in source and binary forms with or without\nmodifications are permitted.

# Require file header
dotnet_diagnostic.IDE0073.severity = error
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Neo.Benchmarks/Benchmarks.Hash.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2024 The Neo Project.
// Copyright (C) 2015-2025 The Neo Project.
//
// Benchmarks.Hash.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Neo.Benchmarks/Benchmarks.POC.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2024 The Neo Project.
// Copyright (C) 2015-2025 The Neo Project.
//
// Benchmarks.POC.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Neo.Benchmarks/Benchmarks.UInt160.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2024 The Neo Project.
// Copyright (C) 2015-2025 The Neo Project.
//
// Benchmarks.UInt160.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2024 The Neo Project.
// Copyright (C) 2015-2025 The Neo Project.
//
// Bechmarks_ReadOnlyStoreView.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Neo.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2024 The Neo Project.
// Copyright (C) 2015-2025 The Neo Project.
//
// Program.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2024 The Neo Project.
// Copyright (C) 2015-2025 The Neo Project.
//
// Benchmarks.StorageKey.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2024 The Neo Project.
// Copyright (C) 2015-2025 The Neo Project.
//
// Benchmark.ByteArrayComparer.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2024 The Neo Project.
// Copyright (C) 2015-2025 The Neo Project.
//
// Benchmark.StringExtensions.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Neo.Extensions.Benchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2015-2024 The Neo Project.
// Copyright (C) 2015-2025 The Neo Project.
//
// Program.cs file belongs to the neo project and is free
// software distributed under the MIT software license, see the
Expand Down
58 changes: 58 additions & 0 deletions benchmarks/Neo.Json.Benchmarks/Benchmark_JBoolean.cs
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 |
57 changes: 57 additions & 0 deletions benchmarks/Neo.Json.Benchmarks/Benchmark_JNumber.cs
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 |
65 changes: 65 additions & 0 deletions benchmarks/Neo.Json.Benchmarks/Benchmark_JObject.cs
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 |
57 changes: 57 additions & 0 deletions benchmarks/Neo.Json.Benchmarks/Benchmark_JPath.cs
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 |
61 changes: 61 additions & 0 deletions benchmarks/Neo.Json.Benchmarks/Benchmark_JString.cs
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 | - | - | - |
Loading

0 comments on commit ebb00e7

Please sign in to comment.