From 12d54d5f5e0b01a5bb0a600e01c89cf8a60efce2 Mon Sep 17 00:00:00 2001 From: Richard Webb Date: Thu, 23 Jul 2020 18:06:40 +0100 Subject: [PATCH] Add [MemoryDiagnoser] to the zip input/output stream benchmark classes --- .../ICSharpCode.SharpZipLib.Benchmark/Zip/ZipInputStream.cs | 5 +++-- .../ICSharpCode.SharpZipLib.Benchmark/Zip/ZipOutputStream.cs | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/benchmark/ICSharpCode.SharpZipLib.Benchmark/Zip/ZipInputStream.cs b/benchmark/ICSharpCode.SharpZipLib.Benchmark/Zip/ZipInputStream.cs index d112e22e3..eb099ebfd 100644 --- a/benchmark/ICSharpCode.SharpZipLib.Benchmark/Zip/ZipInputStream.cs +++ b/benchmark/ICSharpCode.SharpZipLib.Benchmark/Zip/ZipInputStream.cs @@ -4,6 +4,7 @@ namespace ICSharpCode.SharpZipLib.Benchmark.Zip { + [MemoryDiagnoser] [Config(typeof(MultipleRuntimes))] public class ZipInputStream { @@ -12,6 +13,7 @@ public class ZipInputStream private const int N = ChunkCount * ChunkSize; byte[] zippedData; + byte[] readBuffer = new byte[4096]; public ZipInputStream() { @@ -40,10 +42,9 @@ public long ReadZipInputStream() { using (var zipInputStream = new SharpZipLib.Zip.ZipInputStream(memoryStream)) { - var buffer = new byte[4096]; var entry = zipInputStream.GetNextEntry(); - while (zipInputStream.Read(buffer, 0, buffer.Length) > 0) + while (zipInputStream.Read(readBuffer, 0, readBuffer.Length) > 0) { } diff --git a/benchmark/ICSharpCode.SharpZipLib.Benchmark/Zip/ZipOutputStream.cs b/benchmark/ICSharpCode.SharpZipLib.Benchmark/Zip/ZipOutputStream.cs index 0f7b5c7c4..0727ea6f2 100644 --- a/benchmark/ICSharpCode.SharpZipLib.Benchmark/Zip/ZipOutputStream.cs +++ b/benchmark/ICSharpCode.SharpZipLib.Benchmark/Zip/ZipOutputStream.cs @@ -4,6 +4,7 @@ namespace ICSharpCode.SharpZipLib.Benchmark.Zip { + [MemoryDiagnoser] [Config(typeof(MultipleRuntimes))] public class ZipOutputStream {