Skip to content

Benchmarks

Roman Bukin edited this page Aug 13, 2023 · 6 revisions

How to run benchmarks

cd ./src/Dodo.Primitives.Benchmarks
dotnet run -c Release

Benchmark results

BenchmarkDotNet v0.13.7, Windows 11 (10.0.22621.2134/22H2/2022Update/SunValley2)
AMD Ryzen 9 7950X, 1 CPU, 32 logical and 16 physical cores
.NET SDK 7.0.400
  [Host]     : .NET 7.0.10 (7.0.1023.36312), X64 RyuJIT AVX2
  Job-UNWIHG : .NET 7.0.10 (7.0.1023.36312), X64 RyuJIT AVX2

Server=True

1ns = 1s / 1 000 000 000

ToString

Method Mean Error StdDev Gen0 Allocated
guid_ToString_N 14.292 ns 0.2272 ns 0.2125 ns 0.0001 88 B
uuid_ToString_N 9.683 ns 0.0840 ns 0.0786 ns 0.0002 88 B
guid_ToString_D 14.826 ns 0.0996 ns 0.0932 ns 0.0002 96 B
uuid_ToString_D 11.578 ns 0.0781 ns 0.0731 ns 0.0002 96 B
guid_ToString_B 16.164 ns 0.2336 ns 0.2185 ns 0.0002 104 B
uuid_ToString_B 15.390 ns 0.1088 ns 0.0909 ns 0.0002 104 B
guid_ToString_P 17.402 ns 0.1709 ns 0.1599 ns 0.0002 104 B
uuid_ToString_P 14.873 ns 0.1761 ns 0.1647 ns 0.0002 104 B
guid_ToString_X 23.760 ns 0.1438 ns 0.1345 ns 0.0003 160 B
uuid_ToString_X 16.863 ns 0.1423 ns 0.1331 ns 0.0003 160 B

TryParse

Method Mean Error StdDev Allocated
guid_TryParse_N 24.120 ns 0.1550 ns 0.1450 ns -
uuid_TryParse_N 10.091 ns 0.0721 ns 0.0675 ns -
guid_TryParse_D 26.811 ns 0.1555 ns 0.1454 ns -
uuid_TryParse_D 10.891 ns 0.0653 ns 0.0611 ns -
guid_TryParse_B 21.325 ns 0.3124 ns 0.2922 ns -
uuid_TryParse_B 10.953 ns 0.0562 ns 0.0526 ns -
guid_TryParse_P 27.499 ns 0.2092 ns 0.1957 ns -
uuid_TryParse_P 7.718 ns 0.0578 ns 0.0541 ns -
guid_TryParse_X 83.906 ns 1.5916 ns 1.7030 ns -
uuid_TryParse_X 14.254 ns 0.1014 ns 0.0948 ns -

Ctor

Method Mean Error StdDev Allocated
guid_CtorReadOnlySpan 1.3734 ns 0.0168 ns 0.0157 ns -
uuid_CtorReadOnlySpan 0.0124 ns 0.0005 ns 0.0004 ns -
guid_CtorByteArray 0.5409 ns 0.0049 ns 0.0046 ns -
uuid_CtorByteArray 1.1219 ns 0.0013 ns 0.0010 ns -

Overrides

Method Mean Error StdDev Allocated
guid_EqualsDifferentTypesValues 0.2027 ns 0.0143 ns 0.0134 ns -
uuid_EqualsDifferentTypesValues 0.3608 ns 0.0058 ns 0.0054 ns -
guid_EqualsWithNull 0.0115 ns 0.0047 ns 0.0041 ns -
uuid_EqualsWithNull 0.7341 ns 0.0040 ns 0.0035 ns -
guid_EqualsWithSameValueObject 1.1125 ns 0.0113 ns 0.0105 ns -
uuid_EqualsWithSameValueObject 0.4583 ns 0.0059 ns 0.0055 ns -
guid_GetHashCode 0.0929 ns 0.0027 ns 0.0024 ns -
uuid_GetHashCode 0.4980 ns 0.0022 ns 0.0020 ns -

Generator

Method Mean Error StdDev Allocated
guid_New 30.13 ns 0.481 ns 0.450 ns -
uuid_NewTimeBased 58.52 ns 0.163 ns 0.144 ns -
uuid_NewMySqlOptimized 59.88 ns 0.200 ns 0.187 ns -

Implemented interfaces

Method Mean Error StdDev Allocated
guid_CompareTo_T_DifferentValue 0.3667 ns 0.0128 ns 0.0120 ns -
uuid_CompareTo_T_DifferentValue 0.3707 ns 0.0072 ns 0.0068 ns -
guid_CompareToDifferentValueObject 0.9291 ns 0.0116 ns 0.0109 ns -
uuid_CompareToDifferentValueObject 0.7563 ns 0.0077 ns 0.0072 ns -
guid_CompareToNull 0.2097 ns 0.0061 ns 0.0057 ns -
uuid_CompareToNull 0.5514 ns 0.0063 ns 0.0049 ns -
guid_CompareToSameValueObject 3.2134 ns 0.0135 ns 0.0113 ns -
uuid_CompareToSameValueObject 4.1142 ns 0.0173 ns 0.0153 ns -
guid_CompareTo_T_SameValue 2.4947 ns 0.0141 ns 0.0132 ns -
uuid_CompareTo_T_SameValue 3.3793 ns 0.0214 ns 0.0200 ns -
guid_EqualsDifferent 0.9152 ns 0.0076 ns 0.0068 ns -
uuid_EqualsDifferent 0.1002 ns 0.0041 ns 0.0032 ns -
guid_EqualsSame 0.8960 ns 0.0107 ns 0.0100 ns -
uuid_EqualsSame 0.0976 ns 0.0056 ns 0.0052 ns -

Instance methods

Method Mean Error StdDev Gen0 Allocated
guid_ToByteArray 2.9428 ns 0.0734 ns 0.0686 ns 0.0001 40 B
uuid_ToByteArray 3.1487 ns 0.0686 ns 0.0608 ns 0.0001 40 B
guid_TryWriteBytes 0.1722 ns 0.0011 ns 0.0011 ns - -
uuid_TryWriteBytes 0.1724 ns 0.0012 ns 0.0011 ns - -