Skip to content

Commit fd9e8a8

Browse files
authored
#488: Add [MemoryDiagnoser] to the zip input/output stream benchmark classes
1 parent b07ecb4 commit fd9e8a8

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

benchmark/ICSharpCode.SharpZipLib.Benchmark/Zip/ZipInputStream.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace ICSharpCode.SharpZipLib.Benchmark.Zip
66
{
7+
[MemoryDiagnoser]
78
[Config(typeof(MultipleRuntimes))]
89
public class ZipInputStream
910
{
@@ -12,6 +13,7 @@ public class ZipInputStream
1213
private const int N = ChunkCount * ChunkSize;
1314

1415
byte[] zippedData;
16+
byte[] readBuffer = new byte[4096];
1517

1618
public ZipInputStream()
1719
{
@@ -40,10 +42,9 @@ public long ReadZipInputStream()
4042
{
4143
using (var zipInputStream = new SharpZipLib.Zip.ZipInputStream(memoryStream))
4244
{
43-
var buffer = new byte[4096];
4445
var entry = zipInputStream.GetNextEntry();
4546

46-
while (zipInputStream.Read(buffer, 0, buffer.Length) > 0)
47+
while (zipInputStream.Read(readBuffer, 0, readBuffer.Length) > 0)
4748
{
4849

4950
}

benchmark/ICSharpCode.SharpZipLib.Benchmark/Zip/ZipOutputStream.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace ICSharpCode.SharpZipLib.Benchmark.Zip
66
{
7+
[MemoryDiagnoser]
78
[Config(typeof(MultipleRuntimes))]
89
public class ZipOutputStream
910
{

0 commit comments

Comments
 (0)