-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from romadanskiy/benchmarks
Benchmark across .NET versions
- Loading branch information
Showing
5 changed files
with
103 additions
and
57 deletions.
There are no files selected for viewing
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
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
21 changes: 21 additions & 0 deletions
21
src/FlakeId.Benchmarks/FlakeIdMultipleRuntimesBenchmarks.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using BenchmarkDotNet.Diagnostics.Windows.Configs; | ||
using BenchmarkDotNet.Jobs; | ||
|
||
namespace FlakeId.Benchmarks | ||
{ | ||
[SimpleJob(RuntimeMoniker.Net50)] | ||
[SimpleJob(RuntimeMoniker.Net60)] | ||
[SimpleJob(RuntimeMoniker.Net70)] | ||
[SimpleJob(RuntimeMoniker.Net80)] | ||
[DisassemblyDiagnoser] | ||
[InliningDiagnoser(true, null)] | ||
public class FlakeIdMultipleRuntimesBenchmarks | ||
{ | ||
[Benchmark] | ||
public void Single_FlakeId() | ||
{ | ||
Id.Create(); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System; | ||
using BenchmarkDotNet.Attributes; | ||
using BenchmarkDotNet.Diagnostics.Windows.Configs; | ||
using IdGen; | ||
using MassTransit; | ||
|
||
namespace FlakeId.Benchmarks | ||
{ | ||
[DisassemblyDiagnoser] | ||
[InliningDiagnoser(true, null)] | ||
public class IdCreationBenchmarks | ||
{ | ||
private static readonly IdGenerator s_idGenerator = new IdGenerator(10, | ||
new IdGeneratorOptions(sequenceOverflowStrategy: SequenceOverflowStrategy.SpinWait)); | ||
|
||
[Benchmark] | ||
public void Single_FlakeId() | ||
{ | ||
Id.Create(); | ||
} | ||
|
||
[Benchmark] | ||
public void Single_Guid() | ||
{ | ||
Guid.NewGuid(); | ||
} | ||
|
||
[Benchmark] | ||
public void Single_NewId() | ||
{ | ||
NewId.Next(); | ||
} | ||
|
||
[Benchmark] | ||
public void Single_IdGen() | ||
{ | ||
s_idGenerator.CreateId(); | ||
} | ||
} | ||
} |
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