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
namespace BenchmarkDotNet.Samples | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
BenchmarkRunner.Run<TheTypeWithBenchmarks>(DefaultConfig.Instance.With(new SampleIntegrationWithProfiler())); | |
} | |
} |
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
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Running; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace ConcreteVsAbstract | |
{ | |
class Program | |
{ | |
static void Main(string[] args) => BenchmarkRunner.Run<Benchmarks>(); |
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
using System; | |
using System.Runtime.CompilerServices; | |
using System.Threading; | |
namespace Benchmarks | |
{ | |
public class Consumer | |
{ | |
private volatile byte byteHolder; | |
private volatile sbyte sbyteHolder; |
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
public class DebugVsRelease : ManualConfig | |
{ | |
public DebugVsRelease() | |
{ | |
IToolchain toolchain = // to rebuild the project we need to use the CsProj toolchain not the Roslyn one (the default for .NET) | |
#if NETFRAMEWORK | |
CsProjClassicNetToolchain.Current.Value; | |
#else | |
CsProjCoreToolchain.Current.Value; | |
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
using System; | |
using System.Linq; | |
using System.Threading; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Configs; | |
using BenchmarkDotNet.Diagnosers; | |
using BenchmarkDotNet.Jobs; | |
using BenchmarkDotNet.Order; | |
using BenchmarkDotNet.Running; |
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
using System; | |
using System.Diagnostics; | |
using System.Runtime.CompilerServices; | |
using System.Threading; | |
using BenchmarkDotNet.Attributes; | |
namespace BenchmarkDotNet.Samples | |
{ | |
public class MathNano | |
{ |
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
{"exporter": "[email protected]", "name": "simple_example", "activeProfileIndex": 0, "$schema": "https://www.speedscope.app/file-format-schema.json", "shared": { "frames": [ { "name": "Process64 ConsoleApp18 (16156) Args: " }, { "name": "Thread (21900) CPU=348ms (Startup Thread)" }, { "name": "ntdll!RtlUserThreadStart" }, { "name": "ntoskrnl!KiStartUserThreadReturn" }, { "name": "ntoskrnl!KiStartUserThread" }, { "name": "ntoskrnl!PspUserThreadStartup" }, { "name": "ntoskrnl!DbgkCreateThread" }, { "name": "ntoskrnl!PsCallImageNotifyRoutines" }, { "name": "mssecflt!?" }, { "name": "fltmgr!FltCreateFileEx" }, { "name": "fltmgr!FltpCreateFile" }, { "name": "ntoskrnl!IoCreateFileEx" }, { "name": "ntoskrnl!IopCreateFile" }, { "name": "ntoskrnl!ObOpenObjectByNameEx" }, { "name": "ntoskrnl!ObpLookupObjectName" }, { "name": "ntoskrnl!IopParseDevice" }, { "name": "ntoskrnl!IoCallDriverWithTracing" }, { "name": "ntoskrnl!IofCallDriver" }, { "name": "fltmgr!FltpCreate" }, { "name": "fltmgr!FltpPassThroughInternal" }, { "n |
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
{"exporter": "[email protected]", "name": "blog2_full.speedscope", "activeProfileIndex": 0, "$schema": "https://www.speedscope.app/file-format-schema.json", "shared": { "frames": [ { "name": "Process64 ABABABABABA (19392) Args: " }, { "name": "Thread (9076) CPU=1300ms (Startup Thread)" }, { "name": "ntdll!RtlUserThreadStart" }, { "name": "ntoskrnl!KiStartUserThreadReturn" }, { "name": "ntoskrnl!KiStartUserThread" }, { "name": "ntoskrnl!PspUserThreadStartup" }, { "name": "ntoskrnl!DbgkCreateThread" }, { "name": "ntoskrnl!PsCallImageNotifyRoutines" }, { "name": "mssecflt!?" }, { "name": "fltmgr!FltCreateFileEx" }, { "name": "fltmgr!FltpCreateFile" }, { "name": "ntoskrnl!IoCreateFileEx" }, { "name": "ntoskrnl!IopCreateFile" }, { "name": "ntoskrnl!ObOpenObjectByNameEx" }, { "name": "ntoskrnl!ObpLookupObjectName" }, { "name": "ntoskrnl!IopParseDevice" }, { "name": "ntoskrnl!IoCallDriverWithTracing" }, { "name": "ntoskrnl!IofCallDriver" }, { "name": "fltmgr!FltpCreate" }, { "name": "fltmgr!FltpLegacyProcessingAfterP |
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
<Project Sdk="Microsoft.NET.Sdk"> | |
<!-- IMPORTANT! MSBuild sets the Optimize=true only if the Configuration name == Release --> | |
<PropertyGroup Condition="$(Configuration.StartsWith('Release'))"> | |
<Optimize>true</Optimize> | |
</PropertyGroup> | |
<ItemGroup Condition=" '$(Configuration)' == 'Release' Or '$(Configuration)' == 'Debug' "> | |
<ProjectReference Include="SomeProject.csproj" /> | |
</ItemGroup> |
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
public class StringHash | |
{ | |
public static IEnumerable<(CultureInfo CultureInfo, CompareOptions CompareOptions)> GetOptions() | |
{ | |
// Ordinal and OrdinalIgnoreCase use single execution path for all cultures, so we test it only for "en-US" | |
yield return (new CultureInfo("en-US"), CompareOptions.Ordinal); | |
yield return (new CultureInfo("en-US"), CompareOptions.OrdinalIgnoreCase); | |
yield return (new CultureInfo("en-US"), CompareOptions.None); | |
yield return (new CultureInfo("en-US"), CompareOptions.IgnoreCase); |