diff --git a/Snappier.Benchmarks/BlockCompressHtml.cs b/Snappier.Benchmarks/BlockCompressHtml.cs index 8749847..89bb708 100644 --- a/Snappier.Benchmarks/BlockCompressHtml.cs +++ b/Snappier.Benchmarks/BlockCompressHtml.cs @@ -15,11 +15,11 @@ public void LoadToMemory() using var resource = typeof(BlockCompressHtml).Assembly.GetManifestResourceStream("Snappier.Benchmarks.TestData.html"); - byte[] input = new byte[65536]; // Just test the first 64KB + byte[] input = new byte[resource!.Length]; int inputLength = resource!.Read(input, 0, input.Length); _input = input.AsMemory(0, inputLength); - _output = new byte[65536]; + _output = new byte[Snappy.GetMaxCompressedLength(inputLength)]; } [Benchmark] diff --git a/Snappier.Benchmarks/BlockDecompressHtml.cs b/Snappier.Benchmarks/BlockDecompressHtml.cs index 7926805..56cd84a 100644 --- a/Snappier.Benchmarks/BlockDecompressHtml.cs +++ b/Snappier.Benchmarks/BlockDecompressHtml.cs @@ -7,6 +7,7 @@ namespace Snappier.Benchmarks public class BlockDecompressHtml { private ReadOnlyMemory _input; + private Memory _output; [GlobalSetup] public void LoadToMemory() @@ -14,14 +15,16 @@ public void LoadToMemory() using var resource = typeof(DecompressHtml).Assembly.GetManifestResourceStream("Snappier.Benchmarks.TestData.html"); - var input = new byte[65536]; // Just test the first 64KB + byte[] input = new byte[65536]; // Just test the first 64KB // ReSharper disable once PossibleNullReferenceException - resource.Read(input, 0, input.Length); + int inputLength = resource!.Read(input, 0, input.Length); - var compressed = new byte[Snappy.GetMaxCompressedLength(input.Length)]; - var compressedLength = Snappy.Compress(input, compressed); + byte[] compressed = new byte[Snappy.GetMaxCompressedLength(inputLength)]; + int compressedLength = Snappy.Compress(input.AsSpan(0, inputLength), compressed); _input = compressed.AsMemory(0, compressedLength); + + _output = new byte[65536]; } @@ -31,6 +34,7 @@ public void Decompress() var decompressor = new SnappyDecompressor(); decompressor.Decompress(_input.Span); + decompressor.Read(_output.Span); } } } diff --git a/Snappier.Benchmarks/Configuration/VersionComparisonConfig.cs b/Snappier.Benchmarks/Configuration/VersionComparisonConfig.cs index 2b48b10..f96b0de 100644 --- a/Snappier.Benchmarks/Configuration/VersionComparisonConfig.cs +++ b/Snappier.Benchmarks/Configuration/VersionComparisonConfig.cs @@ -51,9 +51,8 @@ private class VersionComparisonOrderer : IOrderer public IEnumerable GetExecutionOrder(ImmutableArray benchmarksCase, IEnumerable order = null) => benchmarksCase - .OrderBy(p => p.Job.Environment.Runtime.Name) - .ThenBy(p => p.Job.Environment.EnvironmentVariables?.FirstOrDefault( - q => q.Key == PgoColumn.PgoEnvironmentVariableName)?.Value ?? "0") + .OrderBy(p => p.Job.Environment.Runtime.MsBuildMoniker) + .ThenBy(p => PgoColumn.IsPgo(p) ? 1 : 0) .ThenBy(p => p.DisplayInfo) .ThenBy(p => !p.Descriptor.Baseline); @@ -65,7 +64,7 @@ public IEnumerable GetSummaryOrder(ImmutableArray public string GetLogicalGroupKey(ImmutableArray allBenchmarksCases, BenchmarkCase benchmarkCase) => - $"{benchmarkCase.Job.Environment.Runtime.Name}-Pgo={(PgoColumn.IsPgo(benchmarkCase) ? "Y" : "N")}"; + $"{benchmarkCase.Job.Environment.Runtime.MsBuildMoniker}-Pgo={(PgoColumn.IsPgo(benchmarkCase) ? "Y" : "N")}"; public IEnumerable> GetLogicalGroupOrder( IEnumerable> logicalGroups,