-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathIntroPowerPlan.cs
More file actions
42 lines (38 loc) · 1.21 KB
/
IntroPowerPlan.cs
File metadata and controls
42 lines (38 loc) · 1.21 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
using System;
namespace BenchmarkDotNet.Samples
{
[Config(typeof(Config))]
[UseLocalJobOnly]
public class IntroPowerPlan
{
private class Config : ManualConfig
{
public Config()
{
AddJob(Job.MediumRun.WithPowerPlan(new Guid("e9a42b02-d5df-448d-aa00-03f14749eb61")));
AddJob(Job.MediumRun.WithPowerPlan(PowerPlan.UltimatePerformance));
AddJob(Job.MediumRun.WithPowerPlan(PowerPlan.UserPowerPlan));
AddJob(Job.MediumRun.WithPowerPlan(PowerPlan.HighPerformance));
AddJob(Job.MediumRun.WithPowerPlan(PowerPlan.Balanced));
AddJob(Job.MediumRun.WithPowerPlan(PowerPlan.PowerSaver));
}
}
[Benchmark]
public int IterationTest()
{
int j = 0;
for (int i = 0; i < short.MaxValue; ++i)
{
j = i;
}
return j;
}
[Benchmark]
public int SplitJoin()
=> string.Join(",", new string[1000]).Split(',').Length;
}
}