Skip to content

Commit 1decac3

Browse files
authored
add timeprovider benchmark (#714)
1 parent 2481186 commit 1decac3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

BitFaster.Caching.Benchmarks/TimeBenchmarks.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace BitFaster.Caching.Benchmarks
1111
[SimpleJob(RuntimeMoniker.Net48)]
1212
#endif
1313
[SimpleJob(RuntimeMoniker.Net60)]
14+
[SimpleJob(RuntimeMoniker.Net90)]
1415
[HideColumns("Job", "Median", "RatioSD", "Alloc Ratio")]
1516
public class TimeBenchmarks
1617
{
@@ -71,6 +72,16 @@ public Duration DurationSinceEpoch()
7172
{
7273
return Duration.SinceEpoch();
7374
}
75+
76+
[Benchmark()]
77+
public long SystemTimeProvider()
78+
{
79+
#if NET8_0_OR_GREATER
80+
return TimeProvider.System.GetTimestamp();
81+
#else
82+
return 0;
83+
#endif
84+
}
7485
}
7586

7687
public static class TickCount64

0 commit comments

Comments
 (0)