-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathProgram.cs
More file actions
26 lines (20 loc) · 753 Bytes
/
Copy pathProgram.cs
File metadata and controls
26 lines (20 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Made by Benjamin Abt - https://github.com/BenjaminAbt
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
BenchmarkRunner.Run<Benchmark>();
[MemoryDiagnoser]
[SimpleJob(RuntimeMoniker.Net70)] // PGO enabled by default
[SimpleJob(RuntimeMoniker.Net80)]
[SimpleJob(RuntimeMoniker.Net90, baseline: true)]
[HideColumns(Column.Job)]
public class Benchmark
{
private string Hello = "Hello"; // no const for benchmarking
private string World = "World"; // no const for benchmarking
[Benchmark]
public string String() => $"[{Hello}][{World}]";
[Benchmark]
public string StringCreate() => string.Create(null, stackalloc char[128], $"[{Hello}][{World}]");
}