GUID TryFormat() .NET 8 performance improvements compared to .NET 7




Date Added (UTC):

15 Apr 2024 @ 19:59

Date Updated (UTC):

15 Apr 2024 @ 19:59


.NET Version(s):

.NET 7 .NET 8

Tag(s):

#.Net8PerfImprovement


Added By:
Profile Image

Blog   
Ireland    
.NET Developer and tech lead from Ireland!

Benchmark Results:





Benchmark Code:



using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Reports;
using System;

[HideColumns("Error", "StdDev", "Median", "RatioSD")]
[MemoryDiagnoser(displayGenColumns: false)]
[Config(typeof(Config))]
public class GUIDTryFormat
{
    private readonly Guid _guid = Guid.Parse("7BD626F6-4396-41E3-A491-4B1DC538DD92");
    private readonly char[] _dest = new char[100];

    [Benchmark]
    [Arguments("D")]
    [Arguments("N")]
    [Arguments("B")]
    [Arguments("P")]
    public bool TryFormat(string format) => _guid.TryFormat(_dest, out _, format);

    private class Config : ManualConfig
    {
        public Config()
        {
            AddJob(Job.Default.WithId(".NET 7").WithRuntime(CoreRuntime.Core70).AsBaseline());
            AddJob(Job.Default.WithId(".NET 8").WithRuntime(CoreRuntime.Core80));

            SummaryStyle =
                SummaryStyle.Default.WithRatioStyle(RatioStyle.Percentage);
        }
    }
}

// .NET 7, .NET 8
public bool TryFormat(string format)
{
    int charsWritten;
    return _guid.TryFormat(_dest, out charsWritten, format);
}

// .NET 7
.assembly _
{
    .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = (
        01 00 08 00 00 00 00 00
    )
    .custom instance void [System.Runtime]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = (
        01 00 01 00 54 02 16 57 72 61 70 4e 6f 6e 45 78
        63 65 70 74 69 6f 6e 54 68 72 6f 77 73 01
    )
    .custom instance void [System.Runtime]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggableAttribute/DebuggingModes) = (
        01 00 02 00 00 00 00 00
    )
    .permissionset reqmin = (
        2e 01 80 8a 53 79 73 74 65 6d 2e 53 65 63 75 72
        69 74 79 2e 50 65 72 6d 69 73 73 69 6f 6e 73 2e
        53 65 63 75 72 69 74 79 50 65 72 6d 69 73 73 69
        6f 6e 41 74 74 72 69 62 75 74 65 2c 20 53 79 73
        74 65 6d 2e 52 75 6e 74 69 6d 65 2c 20 56 65 72
        73 69 6f 6e 3d 37 2e 30 2e 30 2e 30 2c 20 43 75
        6c 74 75 72 65 3d 6e 65 75 74 72 61 6c 2c 20 50
        75 62 6c 69 63 4b 65 79 54 6f 6b 65 6e 3d 62 30
        33 66 35 66 37 66 31 31 64 35 30 61 33 61 15 01
        54 02 10 53 6b 69 70 56 65 72 69 66 69 63 61 74
        69 6f 6e 01
    )
    .hash algorithm 0x00008004 // SHA1
    .ver 0:0:0:0
}

.class private auto ansi '<Module>'
{
} // end of class <Module>

.class public auto ansi beforefieldinit GUIDTryFormat
    extends [System.Runtime]System.Object
{
    .custom instance void [BenchmarkDotNet]BenchmarkDotNet.Attributes.HideColumnsAttribute::.ctor(string[]) = (
        01 00 04 00 00 00 05 45 72 72 6f 72 06 53 74 64
        44 65 76 06 4d 65 64 69 61 6e 07 52 61 74 69 6f
        53 44 00 00
    )
    .custom instance void [BenchmarkDotNet]BenchmarkDotNet.Attributes.MemoryDiagnoserAttribute::.ctor(bool) = (
        01 00 00 00 00
    )
    .custom instance void [BenchmarkDotNet]BenchmarkDotNet.Attributes.ConfigAttribute::.ctor(class [System.Runtime]System.Type) = (
        01 00 14 47 55 49 44 54 72 79 46 6f 72 6d 61 74
        2b 43 6f 6e 66 69 67 00 00
    )
    // Nested Types
    .class nested private auto ansi beforefieldinit Config
        extends [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig
    {
        // Methods
        .method public hidebysig specialname rtspecialname 
            instance void .ctor () cil managed 
        {
            // Method begins at RVA 0x20f0
            // Code size 111 (0x6f)
            .maxstack 6

            // sequence point: (line 37, col 9) to (line 37, col 24) in _
            IL_0000: ldarg.0
            IL_0001: call instance void [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig::.ctor()
            // sequence point: (line 39, col 13) to (line 39, col 95) in _
            IL_0006: ldarg.0
            IL_0007: ldc.i4.1
            IL_0008: newarr [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job
            IL_000d: dup
            IL_000e: ldc.i4.0
            IL_000f: ldsfld !0 class [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobMode`1<class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job>::Default
            IL_0014: ldstr ".NET 7"
            IL_0019: call class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobExtensions::WithId(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job, string)
            IL_001e: ldsfld class [BenchmarkDotNet]BenchmarkDotNet.Environments.CoreRuntime [BenchmarkDotNet]BenchmarkDotNet.Environments.CoreRuntime::Core70
            IL_0023: call class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobExtensions::WithRuntime(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job, class [BenchmarkDotNet]BenchmarkDotNet.Environments.Runtime)
            IL_0028: call class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobExtensions::AsBaseline(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job)
            IL_002d: stelem.ref
            IL_002e: call instance class [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig::AddJob(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job[])
            IL_0033: pop
            // sequence point: (line 40, col 13) to (line 40, col 82) in _
            IL_0034: ldarg.0
            IL_0035: ldc.i4.1
            IL_0036: newarr [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job
            IL_003b: dup
            IL_003c: ldc.i4.0
            IL_003d: ldsfld !0 class [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobMode`1<class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job>::Default
            IL_0042: ldstr ".NET 8"
            IL_0047: call class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobExtensions::WithId(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job, string)
            IL_004c: ldsfld class [BenchmarkDotNet]BenchmarkDotNet.Environments.CoreRuntime [BenchmarkDotNet]BenchmarkDotNet.Environments.CoreRuntime::Core80
            IL_0051: call class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobExtensions::WithRuntime(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job, class [BenchmarkDotNet]BenchmarkDotNet.Environments.Runtime)
            IL_0056: stelem.ref
            IL_0057: call instance class [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig::AddJob(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job[])
            IL_005c: pop
            // sequence point: (line 42, col 13) to (line 43, col 76) in _
            IL_005d: ldarg.0
            IL_005e: ldsfld class [BenchmarkDotNet]BenchmarkDotNet.Reports.SummaryStyle [BenchmarkDotNet]BenchmarkDotNet.Reports.SummaryStyle::Default
            IL_0063: ldc.i4.1
            IL_0064: callvirt instance class [BenchmarkDotNet]BenchmarkDotNet.Reports.SummaryStyle [BenchmarkDotNet]BenchmarkDotNet.Reports.SummaryStyle::WithRatioStyle(valuetype [BenchmarkDotNet]BenchmarkDotNet.Columns.RatioStyle)
            IL_0069: call instance void [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig::set_SummaryStyle(class [BenchmarkDotNet]BenchmarkDotNet.Reports.SummaryStyle)
            // sequence point: (line 44, col 9) to (line 44, col 10) in _
            IL_006e: ret
        } // end of method Config::.ctor

    } // end of class Config


    // Fields
    .field private initonly valuetype [System.Runtime]System.Guid _guid
    .field private initonly char[] _dest
    .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = (
        01 00 01 00 00
    )

    // Methods
    .method public hidebysig 
        instance bool TryFormat (
            string format
        ) cil managed 
    {
        .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = (
            01 00 01 00 00
        )
        .custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.BenchmarkAttribute::.ctor(int32, string) = (
            01 00 1c 00 00 00 01 5f 00 00
        )
        .custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.ArgumentsAttribute::.ctor(object[]) = (
            01 00 01 00 00 00 0e 01 44 00 00
        )
        .custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.ArgumentsAttribute::.ctor(object[]) = (
            01 00 01 00 00 00 0e 01 4e 00 00
        )
        .custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.ArgumentsAttribute::.ctor(object[]) = (
            01 00 01 00 00 00 0e 01 42 00 00
        )
        .custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.ArgumentsAttribute::.ctor(object[]) = (
            01 00 01 00 00 00 0e 01 50 00 00
        )
        // Method begins at RVA 0x20a0
        // Code size 31 (0x1f)
        .maxstack 4
        .locals init (
            [0] int32
        )

        // sequence point: (line 33, col 45) to (line 33, col 82) in _
        IL_0000: ldarg.0
        IL_0001: ldflda valuetype [System.Runtime]System.Guid GUIDTryFormat::_guid
        IL_0006: ldarg.0
        IL_0007: ldfld char[] GUIDTryFormat::_dest
        IL_000c: call valuetype [System.Runtime]System.Span`1<!0> valuetype [System.Runtime]System.Span`1<char>::op_Implicit(!0[])
        IL_0011: ldloca.s 0
        IL_0013: ldarg.1
        IL_0014: call valuetype [System.Runtime]System.ReadOnlySpan`1<char> [System.Runtime]System.String::op_Implicit(string)
        IL_0019: call instance bool [System.Runtime]System.Guid::TryFormat(valuetype [System.Runtime]System.Span`1<char>, int32&, valuetype [System.Runtime]System.ReadOnlySpan`1<char>)
        IL_001e: ret
    } // end of method GUIDTryFormat::TryFormat

    .method public hidebysig specialname rtspecialname 
        instance void .ctor () cil managed 
    {
        // Method begins at RVA 0x20cb
        // Code size 36 (0x24)
        .maxstack 8

        // sequence point: (line 25, col 5) to (line 25, col 86) in _
        IL_0000: ldarg.0
        IL_0001: ldstr "7BD626F6-4396-41E3-A491-4B1DC538DD92"
        IL_0006: call valuetype [System.Runtime]System.Guid [System.Runtime]System.Guid::Parse(string)
        IL_000b: stfld valuetype [System.Runtime]System.Guid GUIDTryFormat::_guid
        // sequence point: (line 26, col 5) to (line 26, col 51) in _
        IL_0010: ldarg.0
        IL_0011: ldc.i4.s 100
        IL_0013: newarr [System.Runtime]System.Char
        IL_0018: stfld char[] GUIDTryFormat::_dest
        IL_001d: ldarg.0
        IL_001e: call instance void [System.Runtime]System.Object::.ctor()
        IL_0023: ret
    } // end of method GUIDTryFormat::.ctor

} // end of class GUIDTryFormat

.class private auto ansi sealed beforefieldinit Microsoft.CodeAnalysis.EmbeddedAttribute
    extends [System.Runtime]System.Attribute
{
    .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
        01 00 00 00
    )
    .custom instance void Microsoft.CodeAnalysis.EmbeddedAttribute::.ctor() = (
        01 00 00 00
    )
    // Methods
    .method public hidebysig specialname rtspecialname 
        instance void .ctor () cil managed 
    {
        // Method begins at RVA 0x2050
        // Code size 7 (0x7)
        .maxstack 8

        IL_0000: ldarg.0
        IL_0001: call instance void [System.Runtime]System.Attribute::.ctor()
        IL_0006: ret
    } // end of method EmbeddedAttribute::.ctor

} // end of class Microsoft.CodeAnalysis.EmbeddedAttribute

.class private auto ansi sealed beforefieldinit System.Runtime.CompilerServices.NullableAttribute
    extends [System.Runtime]System.Attribute
{
    .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
        01 00 00 00
    )
    .custom instance void Microsoft.CodeAnalysis.EmbeddedAttribute::.ctor() = (
        01 00 00 00
    )
    .custom instance void [System.Runtime]System.AttributeUsageAttribute::.ctor(valuetype [System.Runtime]System.AttributeTargets) = (
        01 00 84 6b 00 00 02 00 54 02 0d 41 6c 6c 6f 77
        4d 75 6c 74 69 70 6c 65 00 54 02 09 49 6e 68 65
        72 69 74 65 64 00
    )
    // Fields
    .field public initonly uint8[] NullableFlags

    // Methods
    .method public hidebysig specialname rtspecialname 
        instance void .ctor (
            uint8 ''
        ) cil managed 
    {
        // Method begins at RVA 0x2058
        // Code size 23 (0x17)
        .maxstack 8

        IL_0000: ldarg.0
        IL_0001: call instance void [System.Runtime]System.Attribute::.ctor()
        IL_0006: ldarg.0
        IL_0007: ldc.i4.1
        IL_0008: newarr [System.Runtime]System.Byte
        IL_000d: dup
        IL_000e: ldc.i4.0
        IL_000f: ldarg.1
        IL_0010: stelem.i1
        IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags
        IL_0016: ret
    } // end of method NullableAttribute::.ctor

    .method public hidebysig specialname rtspecialname 
        instance void .ctor (
            uint8[] ''
        ) cil managed 
    {
        // Method begins at RVA 0x2070
        // Code size 14 (0xe)
        .maxstack 8

        IL_0000: ldarg.0
        IL_0001: call instance void [System.Runtime]System.Attribute::.ctor()
        IL_0006: ldarg.0
        IL_0007: ldarg.1
        IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags
        IL_000d: ret
    } // end of method NullableAttribute::.ctor

} // end of class System.Runtime.CompilerServices.NullableAttribute

.class private auto ansi sealed beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute
    extends [System.Runtime]System.Attribute
{
    .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
        01 00 00 00
    )
    .custom instance void Microsoft.CodeAnalysis.EmbeddedAttribute::.ctor() = (
        01 00 00 00
    )
    .custom instance void [System.Runtime]System.AttributeUsageAttribute::.ctor(valuetype [System.Runtime]System.AttributeTargets) = (
        01 00 4c 14 00 00 02 00 54 02 0d 41 6c 6c 6f 77
        4d 75 6c 74 69 70 6c 65 00 54 02 09 49 6e 68 65
        72 69 74 65 64 00
    )
    // Fields
    .field public initonly uint8 Flag

    // Methods
    .method public hidebysig specialname rtspecialname 
        instance void .ctor (
            uint8 ''
        ) cil managed 
    {
        // Method begins at RVA 0x207f
        // Code size 14 (0xe)
        .maxstack 8

        IL_0000: ldarg.0
        IL_0001: call instance void [System.Runtime]System.Attribute::.ctor()
        IL_0006: ldarg.0
        IL_0007: ldarg.1
        IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag
        IL_000d: ret
    } // end of method NullableContextAttribute::.ctor

} // end of class System.Runtime.CompilerServices.NullableContextAttribute

.class private auto ansi sealed beforefieldinit System.Runtime.CompilerServices.RefSafetyRulesAttribute
    extends [System.Runtime]System.Attribute
{
    .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = (
        01 00 00 00
    )
    .custom instance void Microsoft.CodeAnalysis.EmbeddedAttribute::.ctor() = (
        01 00 00 00
    )
    .custom instance void [System.Runtime]System.AttributeUsageAttribute::.ctor(valuetype [System.Runtime]System.AttributeTargets) = (
        01 00 02 00 00 00 02 00 54 02 0d 41 6c 6c 6f 77
        4d 75 6c 74 69 70 6c 65 00 54 02 09 49 6e 68 65
        72 69 74 65 64 00
    )
    // Fields
    .field public initonly int32 Version

    // Methods
    .method public hidebysig specialname rtspecialname 
        instance void .ctor (
            int32 ''
        ) cil managed 
    {
        // Method begins at RVA 0x208e
        // Code size 14 (0xe)
        .maxstack 8

        IL_0000: ldarg.0
        IL_0001: call instance void [System.Runtime]System.Attribute::.ctor()
        IL_0006: ldarg.0
        IL_0007: ldarg.1
        IL_0008: stfld int32 System.Runtime.CompilerServices.RefSafetyRulesAttribute::Version
        IL_000d: ret
    } // end of method RefSafetyRulesAttribute::.ctor

} // end of class System.Runtime.CompilerServices.RefSafetyRulesAttribute



// .NET 8
.assembly _
{
    .custom instance void [System.Runtime]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = (
        01 00 08 00 00 00 00 00
    )
    .custom instance void [System.Runtime]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = (
        01 00 01 00 54 02 16 57 72 61 70 4e 6f 6e 45 78
        63 65 70 74 69 6f 6e 54 68 72 6f 77 73 01
    )
    .custom instance void [System.Runtime]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [System.Runtime]System.Diagnostics.DebuggableAttribute/DebuggingModes) = (
        01 00 02 00 00 00 00 00
    )
    .permissionset reqmin = (
        2e 01 80 8a 53 79 73 74 65 6d 2e 53 65 63 75 72
        69 74 79 2e 50 65 72 6d 69 73 73 69 6f 6e 73 2e
        53 65 63 75 72 69 74 79 50 65 72 6d 69 73 73 69
        6f 6e 41 74 74 72 69 62 75 74 65 2c 20 53 79 73
        74 65 6d 2e 52 75 6e 74 69 6d 65 2c 20 56 65 72
        73 69 6f 6e 3d 38 2e 30 2e 30 2e 30 2c 20 43 75
        6c 74 75 72 65 3d 6e 65 75 74 72 61 6c 2c 20 50
        75 62 6c 69 63 4b 65 79 54 6f 6b 65 6e 3d 62 30
        33 66 35 66 37 66 31 31 64 35 30 61 33 61 15 01
        54 02 10 53 6b 69 70 56 65 72 69 66 69 63 61 74
        69 6f 6e 01
    )
    .hash algorithm 0x00008004 // SHA1
    .ver 0:0:0:0
}

.class private auto ansi '<Module>'
{
} // end of class <Module>

.class public auto ansi beforefieldinit GUIDTryFormat
    extends [System.Runtime]System.Object
{
    .custom instance void [BenchmarkDotNet]BenchmarkDotNet.Attributes.HideColumnsAttribute::.ctor(string[]) = (
        01 00 04 00 00 00 05 45 72 72 6f 72 06 53 74 64
        44 65 76 06 4d 65 64 69 61 6e 07 52 61 74 69 6f
        53 44 00 00
    )
    .custom instance void [BenchmarkDotNet]BenchmarkDotNet.Attributes.MemoryDiagnoserAttribute::.ctor(bool) = (
        01 00 00 00 00
    )
    .custom instance void [BenchmarkDotNet]BenchmarkDotNet.Attributes.ConfigAttribute::.ctor(class [System.Runtime]System.Type) = (
        01 00 14 47 55 49 44 54 72 79 46 6f 72 6d 61 74
        2b 43 6f 6e 66 69 67 00 00
    )
    // Nested Types
    .class nested private auto ansi beforefieldinit Config
        extends [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig
    {
        // Methods
        .method public hidebysig specialname rtspecialname 
            instance void .ctor () cil managed 
        {
            // Method begins at RVA 0x20a0
            // Code size 111 (0x6f)
            .maxstack 6

            // sequence point: (line 37, col 9) to (line 37, col 24) in _
            IL_0000: ldarg.0
            IL_0001: call instance void [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig::.ctor()
            // sequence point: (line 39, col 13) to (line 39, col 95) in _
            IL_0006: ldarg.0
            IL_0007: ldc.i4.1
            IL_0008: newarr [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job
            IL_000d: dup
            IL_000e: ldc.i4.0
            IL_000f: ldsfld !0 class [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobMode`1<class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job>::Default
            IL_0014: ldstr ".NET 7"
            IL_0019: call class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobExtensions::WithId(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job, string)
            IL_001e: ldsfld class [BenchmarkDotNet]BenchmarkDotNet.Environments.CoreRuntime [BenchmarkDotNet]BenchmarkDotNet.Environments.CoreRuntime::Core70
            IL_0023: call class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobExtensions::WithRuntime(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job, class [BenchmarkDotNet]BenchmarkDotNet.Environments.Runtime)
            IL_0028: call class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobExtensions::AsBaseline(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job)
            IL_002d: stelem.ref
            IL_002e: call instance class [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig::AddJob(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job[])
            IL_0033: pop
            // sequence point: (line 40, col 13) to (line 40, col 82) in _
            IL_0034: ldarg.0
            IL_0035: ldc.i4.1
            IL_0036: newarr [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job
            IL_003b: dup
            IL_003c: ldc.i4.0
            IL_003d: ldsfld !0 class [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobMode`1<class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job>::Default
            IL_0042: ldstr ".NET 8"
            IL_0047: call class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobExtensions::WithId(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job, string)
            IL_004c: ldsfld class [BenchmarkDotNet]BenchmarkDotNet.Environments.CoreRuntime [BenchmarkDotNet]BenchmarkDotNet.Environments.CoreRuntime::Core80
            IL_0051: call class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job [BenchmarkDotNet]BenchmarkDotNet.Jobs.JobExtensions::WithRuntime(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job, class [BenchmarkDotNet]BenchmarkDotNet.Environments.Runtime)
            IL_0056: stelem.ref
            IL_0057: call instance class [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig::AddJob(class [BenchmarkDotNet]BenchmarkDotNet.Jobs.Job[])
            IL_005c: pop
            // sequence point: (line 42, col 13) to (line 43, col 76) in _
            IL_005d: ldarg.0
            IL_005e: ldsfld class [BenchmarkDotNet]BenchmarkDotNet.Reports.SummaryStyle [BenchmarkDotNet]BenchmarkDotNet.Reports.SummaryStyle::Default
            IL_0063: ldc.i4.1
            IL_0064: callvirt instance class [BenchmarkDotNet]BenchmarkDotNet.Reports.SummaryStyle [BenchmarkDotNet]BenchmarkDotNet.Reports.SummaryStyle::WithRatioStyle(valuetype [BenchmarkDotNet]BenchmarkDotNet.Columns.RatioStyle)
            IL_0069: call instance void [BenchmarkDotNet]BenchmarkDotNet.Configs.ManualConfig::set_SummaryStyle(class [BenchmarkDotNet]BenchmarkDotNet.Reports.SummaryStyle)
            // sequence point: (line 44, col 9) to (line 44, col 10) in _
            IL_006e: ret
        } // end of method Config::.ctor

    } // end of class Config


    // Fields
    .field private initonly valuetype [System.Runtime]System.Guid _guid
    .field private initonly char[] _dest
    .custom instance void [System.Runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = (
        01 00 01 00 00
    )

    // Methods
    .method public hidebysig 
        instance bool TryFormat (
            string format
        ) cil managed 
    {
        .custom instance void [System.Runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = (
            01 00 01 00 00
        )
        .custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.BenchmarkAttribute::.ctor(int32, string) = (
            01 00 1c 00 00 00 01 5f 00 00
        )
        .custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.ArgumentsAttribute::.ctor(object[]) = (
            01 00 01 00 00 00 0e 01 44 00 00
        )
        .custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.ArgumentsAttribute::.ctor(object[]) = (
            01 00 01 00 00 00 0e 01 4e 00 00
        )
        .custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.ArgumentsAttribute::.ctor(object[]) = (
            01 00 01 00 00 00 0e 01 42 00 00
        )
        .custom instance void [BenchmarkDotNet.Annotations]BenchmarkDotNet.Attributes.ArgumentsAttribute::.ctor(object[]) = (
            01 00 01 00 00 00 0e 01 50 00 00
        )
        // Method begins at RVA 0x2050
        // Code size 31 (0x1f)
        .maxstack 4
        .locals init (
            [0] int32
        )

        // sequence point: (line 33, col 45) to (line 33, col 82) in _
        IL_0000: ldarg.0
        IL_0001: ldflda valuetype [System.Runtime]System.Guid GUIDTryFormat::_guid
        IL_0006: ldarg.0
        IL_0007: ldfld char[] GUIDTryFormat::_dest
        IL_000c: call valuetype [System.Runtime]System.Span`1<!0> valuetype [System.Runtime]System.Span`1<char>::op_Implicit(!0[])
        IL_0011: ldloca.s 0
        IL_0013: ldarg.1
        IL_0014: call valuetype [System.Runtime]System.ReadOnlySpan`1<char> [System.Runtime]System.String::op_Implicit(string)
        IL_0019: call instance bool [System.Runtime]System.Guid::TryFormat(valuetype [System.Runtime]System.Span`1<char>, int32&, valuetype [System.Runtime]System.ReadOnlySpan`1<char>)
        IL_001e: ret
    } // end of method GUIDTryFormat::TryFormat

    .method public hidebysig specialname rtspecialname 
        instance void .ctor () cil managed 
    {
        // Method begins at RVA 0x207b
        // Code size 36 (0x24)
        .maxstack 8

        // sequence point: (line 25, col 5) to (line 25, col 86) in _
        IL_0000: ldarg.0
        IL_0001: ldstr "7BD626F6-4396-41E3-A491-4B1DC538DD92"
        IL_0006: call valuetype [System.Runtime]System.Guid [System.Runtime]System.Guid::Parse(string)
        IL_000b: stfld valuetype [System.Runtime]System.Guid GUIDTryFormat::_guid
        // sequence point: (line 26, col 5) to (line 26, col 51) in _
        IL_0010: ldarg.0
        IL_0011: ldc.i4.s 100
        IL_0013: newarr [System.Runtime]System.Char
        IL_0018: stfld char[] GUIDTryFormat::_dest
        IL_001d: ldarg.0
        IL_001e: call instance void [System.Runtime]System.Object::.ctor()
        IL_0023: ret
    } // end of method GUIDTryFormat::.ctor

} // end of class GUIDTryFormat

// .NET 7 (X64)
; Core CLR 7.0.1624.6629 on x64

GUIDTryFormat..ctor()
    L0000: push rsi
    L0001: sub rsp, 0x50
    L0005: vzeroupper
    L0008: xor eax, eax
    L000a: mov [rsp+0x28], rax
    L000f: mov rsi, rcx
    L0012: mov rcx, 0x1c55ec91ed8
    L001c: mov rcx, [rcx]
    L001f: add rcx, 0xc
    L0023: xor edx, edx
    L0025: vxorps xmm0, xmm0, xmm0
    L0029: vmovdqu [rsp+0x38], xmm0
    L002f: mov [rsp+0x48], edx
    L0033: mov byte ptr [rsp+0x48], 2
    L0038: mov [rsp+0x28], rcx
    L003d: mov dword ptr [rsp+0x30], 0x24
    L0045: lea rcx, [rsp+0x28]
    L004a: lea rdx, [rsp+0x38]
    L004f: call qword ptr [0x7ffa2c03d630]
    L0055: vmovupd xmm0, [rsp+0x38]
    L005b: vmovupd [rsi+0x10], xmm0
    L0060: mov rcx, 0x7ffa2c0cd300
    L006a: mov edx, 0x64
    L006f: call 0x00007ffa8ba5ed60
    L0074: lea rcx, [rsi+8]
    L0078: mov rdx, rax
    L007b: call 0x00007ffa8ba5e4b0
    L0080: nop
    L0081: add rsp, 0x50
    L0085: pop rsi
    L0086: ret

GUIDTryFormat.TryFormat(System.String)
    L0000: push rdi
    L0001: push rsi
    L0002: push rbx
    L0003: sub rsp, 0x50
    L0007: xor eax, eax
    L0009: mov [rsp+0x28], rax
    L000e: vxorps xmm4, xmm4, xmm4
    L0012: vmovdqa [rsp+0x30], xmm4
    L0018: vmovdqa [rsp+0x40], xmm4
    L001e: lea rsi, [rcx+0x10]
    L0022: mov rcx, [rcx+8]
    L0026: test rcx, rcx
    L0029: je short L007a
    L002b: lea rdi, [rcx+0x10]
    L002f: mov ebx, [rcx+8]
    L0032: test rdx, rdx
    L0035: je short L0073
    L0037: lea rcx, [rdx+0xc]
    L003b: mov r9d, [rdx+8]
    L003f: mov [rsp+0x38], rdi
    L0044: mov [rsp+0x40], ebx
    L0048: mov [rsp+0x28], rcx
    L004d: mov [rsp+0x30], r9d
    L0052: mov rcx, rsi
    L0055: lea rdx, [rsp+0x38]
    L005a: lea r9, [rsp+0x28]
    L005f: lea r8, [rsp+0x48]
    L0064: call qword ptr [0x7ffa2c03d978]
    L006a: nop
    L006b: add rsp, 0x50
    L006f: pop rbx
    L0070: pop rsi
    L0071: pop rdi
    L0072: ret
    L0073: xor ecx, ecx
    L0075: xor r9d, r9d
    L0078: jmp short L003f
    L007a: xor edi, edi
    L007c: xor ebx, ebx
    L007e: jmp short L0032

GUIDTryFormat+Config..ctor()
    L0000: push rdi
    L0001: push rsi
    L0002: push rbp
    L0003: push rbx
    L0004: sub rsp, 0x28
    L0008: mov rsi, rcx
    L000b: mov rcx, rsi
    L000e: call qword ptr [0x7ffa31c4f6a8]
    L0014: mov rcx, 0x7ffa321c2b18
    L001e: mov edx, 1
    L0023: call 0x00007ffa8ba5edc0
    L0028: mov rdi, rax
    L002b: mov rcx, 0x7ffa31c7b280
    L0035: xor edx, edx
    L0037: call 0x00007ffa8ba24d50
    L003c: mov rcx, 0x1c55ec6f418
    L0046: mov rbx, [rcx]
    L0049: mov rcx, 0x7ffa321c2848
    L0053: call 0x00007ffa8ba5ec40
    L0058: mov rbp, rax
    L005b: mov rdx, 0x1c55ec90398
    L0065: mov rdx, [rdx]
    L0068: mov rcx, rbp
    L006b: call qword ptr [0x7ffa321a38d0]
    L0071: mov rcx, rbp
    L0074: mov rdx, rbx
    L0077: call qword ptr [0x7ffa321a3228]
    L007d: mov r8, rax
    L0080: mov rdx, rbx
    L0083: mov rcx, rbp
    L0086: call qword ptr [0x7ffa321a3420]
    L008c: test rax, rax
    L008f: je short L00a4
    L0091: mov rcx, 0x7ffa321c2848
    L009b: cmp [rax], rcx
    L009e: jne L01e3
    L00a4: mov rcx, 0x7ffa31c7b280
    L00ae: mov edx, 0x1a8
    L00b3: call 0x00007ffa8ba5ee10
    L00b8: mov rdx, 0x1c55ec6da20
    L00c2: mov rdx, [rdx]
    L00c5: mov rcx, rbp
    L00c8: call qword ptr [0x7ffa321a5090]
    L00ce: mov rcx, rax
    L00d1: call qword ptr [0x7ffa321a55b8]
    L00d7: lea rcx, [rdi+0x10]
    L00db: mov rdx, rax
    L00de: call 0x00007ffa8ba5e4b0
    L00e3: mov rcx, rsi
    L00e6: mov rdx, rdi
    L00e9: call qword ptr [0x7ffa31c4f4e0]
    L00ef: mov rcx, 0x7ffa321c2b18
    L00f9: mov edx, 1
    L00fe: call 0x00007ffa8ba5edc0
    L0103: mov rdi, rax
    L0106: mov rcx, 0x1c55ec6f418
    L0110: mov rbx, [rcx]
    L0113: mov rcx, 0x7ffa321c2848
    L011d: call 0x00007ffa8ba5ec40
    L0122: mov rbp, rax
    L0125: mov rdx, 0x1c55ec903a0
    L012f: mov rdx, [rdx]
    L0132: mov rcx, rbp
    L0135: call qword ptr [0x7ffa321a38d0]
    L013b: mov rcx, rbp
    L013e: mov rdx, rbx
    L0141: call qword ptr [0x7ffa321a3228]
    L0147: mov r8, rax
    L014a: mov rdx, rbx
    L014d: mov rcx, rbp
    L0150: call qword ptr [0x7ffa321a3420]
    L0156: test rax, rax
    L0159: je short L016e
    L015b: mov rcx, 0x7ffa321c2848
    L0165: cmp [rax], rcx
    L0168: jne L01ed
    L016e: mov rdx, 0x1c55ec6da28
    L0178: mov rdx, [rdx]
    L017b: mov rcx, rbp
    L017e: call qword ptr [0x7ffa321a5090]
    L0184: lea rcx, [rdi+0x10]
    L0188: mov rdx, rax
    L018b: call 0x00007ffa8ba5e4b0
    L0190: mov rcx, rsi
    L0193: mov rdx, rdi
    L0196: call qword ptr [0x7ffa31c4f4e0]
    L019c: mov rcx, 0x7ffa31c7b280
    L01a6: mov edx, 0xf7
    L01ab: call 0x00007ffa8ba5ee10
    L01b0: mov rcx, 0x1c55ec6d4e8
    L01ba: mov rcx, [rcx]
    L01bd: mov edx, 1
    L01c2: cmp [rcx], ecx
    L01c4: call qword ptr [0x7ffa321a5a08]
    L01ca: lea rcx, [rsi+0x88]
    L01d1: mov rdx, rax
    L01d4: call 0x00007ffa8ba5e4b0
    L01d9: nop
    L01da: add rsp, 0x28
    L01de: pop rbx
    L01df: pop rbp
    L01e0: pop rsi
    L01e1: pop rdi
    L01e2: ret
    L01e3: mov rdx, rax
    L01e6: call qword ptr [0x7ffa2bf5b8b8]
    L01ec: int3
    L01ed: mov rdx, rax
    L01f0: call qword ptr [0x7ffa2bf5b8b8]
    L01f6: int3

Microsoft.CodeAnalysis.EmbeddedAttribute..ctor()
    L0000: ret

System.Runtime.CompilerServices.NullableAttribute..ctor(Byte)
    L0000: push rdi
    L0001: push rsi
    L0002: sub rsp, 0x28
    L0006: mov rsi, rcx
    L0009: mov edi, edx
    L000b: mov rcx, 0x7ffa2c078700
    L0015: mov edx, 1
    L001a: call 0x00007ffa8ba5ed60
    L001f: mov [rax+0x10], dil
    L0023: lea rcx, [rsi+8]
    L0027: mov rdx, rax
    L002a: call 0x00007ffa8ba5e4b0
    L002f: nop
    L0030: add rsp, 0x28
    L0034: pop rsi
    L0035: pop rdi
    L0036: ret

System.Runtime.CompilerServices.NullableAttribute..ctor(Byte[])
    L0000: lea rcx, [rcx+8]
    L0004: call 0x00007ffa8ba5e4b0
    L0009: nop
    L000a: ret

System.Runtime.CompilerServices.NullableContextAttribute..ctor(Byte)
    L0000: mov [rcx+8], dl
    L0003: ret

System.Runtime.CompilerServices.RefSafetyRulesAttribute..ctor(Int32)
    L0000: mov [rcx+8], edx
    L0003: ret
// .NET 8 (X64)
; Core CLR 8.0.123.58001 on x64

GUIDTryFormat..ctor()
    L0000: push rbx
    L0001: sub rsp, 0x50
    L0005: vzeroupper
    L0008: xor eax, eax
    L000a: mov [rsp+0x28], rax
    L000f: mov rbx, rcx
    L0012: mov rcx, 0x1bf050654e0
    L001c: mov rcx, [rcx]
    L001f: add rcx, 0xc
    L0023: vxorps xmm0, xmm0, xmm0
    L0027: vmovdqu [rsp+0x38], xmm0
    L002d: vmovdqu [rsp+0x3c], xmm0
    L0033: mov byte ptr [rsp+0x48], 2
    L0038: mov [rsp+0x28], rcx
    L003d: mov dword ptr [rsp+0x30], 0x24
    L0045: lea rcx, [rsp+0x28]
    L004a: lea rdx, [rsp+0x38]
    L004f: call qword ptr [0x7ff9db2f6df0]
    L0055: vmovups xmm0, [rsp+0x38]
    L005b: vmovups [rbx+0x10], xmm0
    L0060: mov rcx, 0x7ff9db3c3038
    L006a: mov edx, 0x64
    L006f: call 0x00007ffa3addaf30
    L0074: lea rcx, [rbx+8]
    L0078: mov rdx, rax
    L007b: call 0x00007ffa3adda680
    L0080: nop
    L0081: add rsp, 0x50
    L0085: pop rbx
    L0086: ret

GUIDTryFormat.TryFormat(System.String)
    L0000: push rdi
    L0001: push rsi
    L0002: push rbx
    L0003: sub rsp, 0x50
    L0007: xor eax, eax
    L0009: mov [rsp+0x28], rax
    L000e: vxorps xmm4, xmm4, xmm4
    L0012: vmovdqa [rsp+0x30], xmm4
    L0018: vmovdqa [rsp+0x40], xmm4
    L001e: lea rbx, [rcx+0x10]
    L0022: mov rcx, [rcx+8]
    L0026: test rcx, rcx
    L0029: je short L007a
    L002b: lea rsi, [rcx+0x10]
    L002f: mov edi, [rcx+8]
    L0032: test rdx, rdx
    L0035: jne short L003e
    L0037: xor ecx, ecx
    L0039: xor r9d, r9d
    L003c: jmp short L0046
    L003e: lea rcx, [rdx+0xc]
    L0042: mov r9d, [rdx+8]
    L0046: mov [rsp+0x38], rsi
    L004b: mov [rsp+0x40], edi
    L004f: mov [rsp+0x28], rcx
    L0054: mov [rsp+0x30], r9d
    L0059: mov rcx, rbx
    L005c: lea rdx, [rsp+0x38]
    L0061: lea r9, [rsp+0x28]
    L0066: lea r8, [rsp+0x48]
    L006b: call qword ptr [0x7ff9db32cf78]
    L0071: nop
    L0072: add rsp, 0x50
    L0076: pop rbx
    L0077: pop rsi
    L0078: pop rdi
    L0079: ret
    L007a: xor esi, esi
    L007c: xor edi, edi
    L007e: jmp short L0032

GUIDTryFormat+Config..ctor()
    L0000: push rdi
    L0001: push rsi
    L0002: push rbp
    L0003: push rbx
    L0004: sub rsp, 0x28
    L0008: mov rbx, rcx
    L000b: mov rcx, rbx
    L000e: call qword ptr [0x7ff9e18bcc48]
    L0014: mov rcx, 0x7ff9e1bf8120
    L001e: mov edx, 1
    L0023: call 0x00007ffa3addaf90
    L0028: mov rsi, rax
    L002b: mov rcx, 0x7ff9e19451a0
    L0035: xor edx, edx
    L0037: call 0x00007ffa3ad8e880
    L003c: mov rcx, 0x1bf05045818
    L0046: mov rdi, [rcx]
    L0049: mov rcx, 0x7ff9e1bf7e78
    L0053: call 0x00007ffa3addae10
    L0058: mov rbp, rax
    L005b: mov rdx, 0x1bf050654d0
    L0065: mov rdx, [rdx]
    L0068: mov rcx, rbp
    L006b: call qword ptr [0x7ff9e1bd7e70]
    L0071: mov rcx, rdi
    L0074: cmp [rcx], ecx
    L0076: call qword ptr [0x7ff9e1bd77b0]
    L007c: mov r8, rax
    L007f: mov rcx, rbp
    L0082: mov rdx, rdi
    L0085: call qword ptr [0x7ff9e1bd79c0]
    L008b: test rax, rax
    L008e: je short L00a3
    L0090: mov rcx, 0x7ff9e1bf7e78
    L009a: cmp [rax], rcx
    L009d: jne L01cf
    L00a3: test byte ptr [0x7ff9e1945373], 1
    L00aa: je L01d9
    L00b0: mov rdx, 0x1bf05043e20
    L00ba: mov rdx, [rdx]
    L00bd: mov rcx, rbp
    L00c0: call qword ptr [0x7ff9e1bdc090]
    L00c6: mov rcx, rax
    L00c9: call qword ptr [0x7ff9e1bdc5b8]
    L00cf: lea rcx, [rsi+0x10]
    L00d3: mov rdx, rax
    L00d6: call 0x00007ffa3adda680
    L00db: mov rcx, rbx
    L00de: mov rdx, rsi
    L00e1: call qword ptr [0x7ff9e18bca80]
    L00e7: mov rcx, 0x7ff9e1bf8120
    L00f1: mov edx, 1
    L00f6: call 0x00007ffa3addaf90
    L00fb: mov rsi, rax
    L00fe: mov rcx, 0x1bf05045818
    L0108: mov rbp, [rcx]
    L010b: mov rcx, 0x7ff9e1bf7e78
    L0115: call 0x00007ffa3addae10
    L011a: mov rdi, rax
    L011d: mov rdx, 0x1bf050654d8
    L0127: mov rdx, [rdx]
    L012a: mov rcx, rdi
    L012d: call qword ptr [0x7ff9e1bd7e70]
    L0133: mov rcx, rbp
    L0136: cmp [rcx], ecx
    L0138: call qword ptr [0x7ff9e1bd77b0]
    L013e: mov r8, rax
    L0141: mov rcx, rdi
    L0144: mov rdx, rbp
    L0147: call qword ptr [0x7ff9e1bd79c0]
    L014d: test rax, rax
    L0150: je short L0165
    L0152: mov rcx, 0x7ff9e1bf7e78
    L015c: cmp [rax], rcx
    L015f: jne L01f2
    L0165: mov rdx, 0x1bf05043e28
    L016f: mov rdx, [rdx]
    L0172: mov rcx, rdi
    L0175: call qword ptr [0x7ff9e1bdc090]
    L017b: lea rcx, [rsi+0x10]
    L017f: mov rdx, rax
    L0182: call 0x00007ffa3adda680
    L0187: mov rcx, rbx
    L018a: mov rdx, rsi
    L018d: call qword ptr [0x7ff9e18bca80]
    L0193: test byte ptr [0x7ff9e19452c2], 1
    L019a: je short L01fc
    L019c: mov rcx, 0x1bf050438e8
    L01a6: mov rcx, [rcx]
    L01a9: mov edx, 1
    L01ae: cmp [rcx], ecx
    L01b0: call qword ptr [0x7ff9e1bdca08]
    L01b6: lea rcx, [rbx+0x88]
    L01bd: mov rdx, rax
    L01c0: call 0x00007ffa3adda680
    L01c5: nop
    L01c6: add rsp, 0x28
    L01ca: pop rbx
    L01cb: pop rbp
    L01cc: pop rsi
    L01cd: pop rdi
    L01ce: ret
    L01cf: mov rdx, rax
    L01d2: call qword ptr [0x7ff9db2443f0]
    L01d8: int3
    L01d9: mov rcx, 0x7ff9e19451a0
    L01e3: mov edx, 0x1a3
    L01e8: call 0x00007ffa3addafe0
    L01ed: jmp L00b0
    L01f2: mov rdx, rax
    L01f5: call qword ptr [0x7ff9db2443f0]
    L01fb: int3
    L01fc: mov rcx, 0x7ff9e19451a0
    L0206: mov edx, 0xf2
    L020b: call 0x00007ffa3addafe0
    L0210: jmp short L019c


Benchmark Description:


The provided benchmark code is designed to measure the performance of the `Guid.TryFormat` method across different formats in .NET. It uses the BenchmarkDotNet library, a popular .NET library for benchmarking code performance. The setup involves comparing the performance of this operation across different .NET runtime versions, specifically .NET 7 and .NET 8, to understand how performance might have changed between these versions. The benchmark is configured to focus on the time it takes to execute the `TryFormat` method under different format specifications without displaying certain statistical columns like Error, StdDev (Standard Deviation), Median, and RatioSD but includes memory diagnostics with a specific configuration to hide garbage collection generation columns. ### General Setup - **.NET Versions:** The benchmark is explicitly set up to compare .NET 7 and .NET 8, using the `CoreRuntime.Core70` and `CoreRuntime.Core80` respectively. This comparison aims to highlight performance improvements or regressions between these versions. - **Configuration:** The benchmark class is decorated with attributes to control the output and behavior of the benchmark. It uses a custom configuration class `Config` to define jobs for .NET 7 and .NET 8, marking .NET 7 as the baseline for comparison. The summary style is adjusted to show ratio percentages, making it easier to understand performance differences. - **Memory Diagnoser:** Enabled with `MemoryDiagnoser` attribute to collect memory allocation data, but configured not to display garbage collection generation columns to focus on allocation size. ### Benchmark Methods #### `TryFormat(string format)` - **Purpose:** This method tests the performance of the `Guid.TryFormat` method with different format strings. The `Guid.TryFormat` method is used to write a `Guid` value to a destination character span with a specified format. This operation is common in applications that need to serialize `Guid` values to strings for logging, output, or storage in various formats. - **Performance Aspect:** It measures how quickly the `Guid` can be formatted into a character array using different format specifiers. The format specifiers tested are "D", "N", "B", and "P", which represent different styles of `Guid` string representations (with hyphens, without hyphens, with braces, and with parentheses, respectively). - **Expected Insights:** - **Execution Time:** The benchmark will reveal how the execution time varies with different format specifiers. Some formats might be quicker to generate due to fewer characters or simpler processing. - **.NET Version Comparison:** By running this benchmark across .NET 7 and .NET 8, one can identify if there have been performance optimizations in the newer version of the .NET runtime for the `Guid.TryFormat` method. - **Memory Allocation:** While the primary focus is on execution time, the memory diagnoser will also reveal if there are differences in memory allocation between the different formats and .NET versions. This is important for understanding the overall efficiency of the operation, especially in high-throughput or memory-sensitive applications. ### Conclusion Running this benchmark will provide valuable insights into the performance characteristics of the `Guid.TryFormat` method across different formats and .NET versions. It will help developers understand the trade-offs between different formats in terms of execution speed and memory efficiency, and guide optimization efforts, especially when working with `Guid` values extensively in their applications.


Benchmark Comments: