File tree 6 files changed +106
-3
lines changed
samples/Thinktecture.Runtime.Extensions.Benchmarking
6 files changed +106
-3
lines changed Original file line number Diff line number Diff line change 8
8
9
9
namespace Thinktecture . Benchmarks ;
10
10
11
+ /*
12
+
13
+ 22.01.2025
14
+
15
+ .NET 9.0.1
16
+
17
+ | Method | SearchTerm | Mean | Error | StdDev | Median | Allocated |
18
+ |-------------------------- |----------- |----------:|----------:|----------:|----------:|----------:|
19
+ | Dictionary | aaaaAaaaaa | 16.693 ns | 1.1213 ns | 3.3061 ns | 17.322 ns | - |
20
+ | FrozenDictionary | aaaaAaaaaa | 6.703 ns | 0.1758 ns | 0.1644 ns | 6.683 ns | - |
21
+ | ReadOnlyDictionary | aaaaAaaaaa | 12.893 ns | 0.3104 ns | 0.6341 ns | 12.690 ns | - |
22
+ | ImmutableDictionary | aaaaAaaaaa | 17.369 ns | 0.2967 ns | 0.2478 ns | 17.365 ns | - |
23
+ | ImmutableSortedDictionary | aaaaAaaaaa | 17.929 ns | 0.4007 ns | 0.9601 ns | 17.715 ns | - |
24
+ | ArrayIteration | aaaaAaaaaa | 2.973 ns | 0.1116 ns | 0.1044 ns | 2.937 ns | - |
25
+
26
+ | Dictionary | iiiiIiiiii | 9.904 ns | 0.2482 ns | 0.2438 ns | 9.821 ns | - |
27
+ | FrozenDictionary | iiiiIiiiii | 7.024 ns | 0.1959 ns | 0.5363 ns | 6.867 ns | - |
28
+ | ReadOnlyDictionary | iiiiIiiiii | 12.080 ns | 0.2953 ns | 0.6544 ns | 11.967 ns | - |
29
+ | ImmutableDictionary | iiiiIiiiii | 17.562 ns | 0.3981 ns | 0.7280 ns | 17.336 ns | - |
30
+ | ImmutableSortedDictionary | iiiiIiiiii | 22.474 ns | 0.4374 ns | 0.7064 ns | 22.262 ns | - |
31
+ | ArrayIteration | iiiiIiiiii | 21.703 ns | 0.4796 ns | 0.6402 ns | 21.619 ns | - |
32
+
33
+ | Dictionary | tttttTtttt | 9.533 ns | 0.2432 ns | 0.3928 ns | 9.524 ns | - |
34
+ | FrozenDictionary | tttttTtttt | 6.943 ns | 0.1874 ns | 0.2370 ns | 6.945 ns | - |
35
+ | ReadOnlyDictionary | tttttTtttt | 11.460 ns | 0.2830 ns | 0.4570 ns | 11.473 ns | - |
36
+ | ImmutableDictionary | tttttTtttt | 17.708 ns | 0.3967 ns | 0.4245 ns | 17.626 ns | - |
37
+ | ImmutableSortedDictionary | tttttTtttt | 23.327 ns | 0.5152 ns | 1.5030 ns | 22.802 ns | - |
38
+ | ArrayIteration | tttttTtttt | 47.615 ns | 0.9459 ns | 0.9714 ns | 47.931 ns | - |
39
+
40
+
41
+ */
42
+
11
43
public class ItemSearch
12
44
{
13
45
public class SmartEnum
Original file line number Diff line number Diff line change 8
8
9
9
namespace Thinktecture . Benchmarks ;
10
10
11
+ /*
12
+
13
+ 22.01.2025
14
+
15
+ .NET 9.0.1
16
+
17
+ | Method | Mean | Error | StdDev | Median | Allocated |
18
+ |----------------------------- |----------:|----------:|----------:|----------:|----------:|
19
+ | Real_Enum_StringConverter | 15.722 ms | 3.4459 ms | 10.106 ms | 10.545 ms | 7.16 MB |
20
+ | SmartEnum_Struct_StringBased | 12.430 ms | 2.6370 ms | 7.307 ms | 10.046 ms | 8.51 MB |
21
+ | SmartEnum_Class_StringBased | 9.328 ms | 1.1271 ms | 3.008 ms | 8.682 ms | 8.21 MB |
22
+ | Real_Enum_IntBased | 6.801 ms | 1.0520 ms | 2.826 ms | 5.830 ms | 6.67 MB |
23
+ | SmartEnum_Struct_IntBased | 7.341 ms | 0.8959 ms | 2.482 ms | 6.327 ms | 8.03 MB |
24
+ | SmartEnum_Class_IntBased | 7.453 ms | 0.8701 ms | 2.352 ms | 6.643 ms | 7.72 MB |
25
+
26
+ */
27
+
11
28
// ReSharper disable InconsistentNaming
12
29
public class LoadingSmartEnums
13
30
{
Original file line number Diff line number Diff line change 7
7
8
8
namespace Thinktecture . Benchmarks ;
9
9
10
+ /*
11
+
12
+ 22.01.2025
13
+
14
+ .NET 9.0.1
15
+
16
+ | Method | Mean | Error | StdDev | Median | Gen0 | Gen1 | Allocated |
17
+ |------------------------------- |---------:|--------:|---------:|---------:|----------:|----------:|----------:|
18
+ | Entity_with_ValueObjects | 178.4 ms | 7.83 ms | 22.73 ms | 172.4 ms | 4000.0000 | 3000.0000 | 89.13 MB |
19
+ | Entity_without_ValueObjects | 175.6 ms | 8.77 ms | 25.84 ms | 166.2 ms | 4000.0000 | 3000.0000 | 84.55 MB |
20
+ | Entity_with_StructValueObjects | 164.7 ms | 8.33 ms | 24.30 ms | 157.5 ms | 4000.0000 | 3000.0000 | 92.61 MB |
21
+
22
+ */
23
+
10
24
// ReSharper disable InconsistentNaming
11
25
public class LoadingValueObjects
12
26
{
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using BenchmarkDotNet . Attributes ;
3
+
4
+ namespace Thinktecture . Benchmarks ;
5
+
6
+ /*
7
+
8
+ 22.01.2025
9
+
10
+ .NET 9.0.1
11
+
12
+ | Method | Mean | Error | StdDev | Median | Allocated |
13
+ |----------------- |---------:|---------:|---------:|---------:|----------:|
14
+ | Guid_NewGuid | 56.12 ns | 2.936 ns | 8.658 ns | 59.00 ns | - |
15
+ | CustomerId_NewId | 41.61 ns | 0.861 ns | 1.024 ns | 41.94 ns | - |
16
+
17
+ */
18
+
19
+ public class TypedIdBenchmarks
20
+ {
21
+ [ Benchmark ]
22
+ public Guid Guid_NewGuid ( )
23
+ {
24
+ return Guid . NewGuid ( ) ;
25
+ }
26
+
27
+ [ Benchmark ]
28
+ public CustomerId CustomerId_NewId ( )
29
+ {
30
+ return CustomerId . NewId ( ) ;
31
+ }
32
+ }
33
+
34
+ [ ValueObject < Guid > ]
35
+ public partial struct CustomerId
36
+ {
37
+ public static CustomerId NewId ( ) => new ( Guid . NewGuid ( ) ) ;
38
+ }
Original file line number Diff line number Diff line change 7
7
8
8
var config = ManualConfig . CreateMinimumViable ( )
9
9
. AddDiagnoser ( new MemoryDiagnoser ( new MemoryDiagnoserConfig ( ) ) )
10
- . AddJob ( Job . Default . WithRuntime ( CoreRuntime . Core70 ) ) ;
10
+ . AddJob ( Job . Default . WithRuntime ( CoreRuntime . Core90 ) ) ;
11
11
12
12
// BenchmarkRunner.Run<LoadingSmartEnums>(config);
13
13
// BenchmarkRunner.Run<LoadingValueObjects>(config);
14
14
// BenchmarkRunner.Run<SingleItemCollectionBenchmarks>(config);
15
15
// BenchmarkRunner.Run<SingleItemSetBenchmarks>(config);
16
- BenchmarkRunner . Run < ItemSearch > ( config ) ;
16
+ // BenchmarkRunner.Run<ItemSearch>(config);
17
+ BenchmarkRunner . Run < TypedIdBenchmarks > ( config ) ;
Original file line number Diff line number Diff line change 13
13
</ItemGroup >
14
14
15
15
<ItemGroup >
16
- <ProjectReference Include =" ..\..\src\Thinktecture.Runtime.Extensions.EntityFrameworkCore7\Thinktecture.Runtime.Extensions.EntityFrameworkCore7.csproj" />
16
+ <ProjectReference Include =" ..\..\src\Thinktecture.Runtime.Extensions.EntityFrameworkCore9\Thinktecture.Runtime.Extensions.EntityFrameworkCore9.csproj" />
17
+ <ProjectReference Include =" ..\..\src\Thinktecture.Runtime.Extensions.Json\Thinktecture.Runtime.Extensions.Json.csproj" />
17
18
<ProjectReference Include =" ..\..\src\Thinktecture.Runtime.Extensions.SourceGenerator\Thinktecture.Runtime.Extensions.SourceGenerator.csproj" SetTargetFramework =" TargetFramework=netstandard2.0" ReferenceOutputAssembly =" false" OutputItemType =" Analyzer" />
18
19
</ItemGroup >
19
20
You can’t perform that action at this time.
0 commit comments