@@ -18,15 +18,34 @@ public class CacheKeyBenchmarks
1818 { "width" , "400" }
1919 } ;
2020
21+ private static readonly ICacheKey CacheKeyBaseline = new CacheKeyBaseline ( ) ;
2122 private static readonly ICacheKey UriRelativeCacheKey = new UriRelativeCacheKey ( ) ;
2223 private static readonly ICacheKey UriAbsoluteCacheKey = new UriAbsoluteCacheKey ( ) ;
2324
24- [ Benchmark ( Baseline = true , Description = "UriRelativeCacheKey" ) ]
25+ [ Benchmark ( Baseline = true , Description = "Baseline" ) ]
26+ public string CreateUsingBaseline ( ) => CacheKeyBaseline . Create ( Context , Commands ) ;
27+
28+ [ Benchmark ( Description = "UriRelativeCacheKey" ) ]
2529 public string CreateUsingUriRelativeCacheKey ( ) => UriRelativeCacheKey . Create ( Context , Commands ) ;
2630
2731 [ Benchmark ( Description = "UriAbsoluteCacheKey" ) ]
2832 public string CreateUsingUriAbsoluteCacheKey ( ) => UriAbsoluteCacheKey . Create ( Context , Commands ) ;
2933
34+ /*
35+ BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000
36+ Intel Core i7-10750H CPU 2.60GHz, 1 CPU, 12 logical and 6 physical cores
37+ .NET SDK=6.0.101
38+ [Host] : .NET Core 3.1.22 (CoreCLR 4.700.21.56803, CoreFX 4.700.21.57101), X64 RyuJIT
39+ DefaultJob : .NET Core 3.1.22 (CoreCLR 4.700.21.56803, CoreFX 4.700.21.57101), X64 RyuJIT
40+
41+
42+ | Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Allocated |
43+ |-------------------- |---------:|--------:|--------:|------:|--------:|-------:|----------:|
44+ | Baseline | 497.4 ns | 8.26 ns | 7.33 ns | 1.00 | 0.00 | 0.1106 | 696 B |
45+ | UriRelativeCacheKey | 270.9 ns | 5.47 ns | 7.11 ns | 0.55 | 0.02 | 0.0587 | 368 B |
46+ | UriAbsoluteCacheKey | 447.4 ns | 3.38 ns | 3.16 ns | 0.90 | 0.01 | 0.0939 | 592 B |
47+ */
48+
3049 private static HttpContext CreateContext ( )
3150 {
3251 var httpContext = new DefaultHttpContext ( ) ;
0 commit comments