Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,4 @@ paket-files/
/test/ICSharpCode.SharpZipLib.TestBootstrapper/Properties/launchSettings.json
_testRunner/
docs/help/api/.manifest
/benchmark/ICSharpCode.SharpZipLib.Benchmark/BenchmarkDotNet.Artifacts/results
21 changes: 21 additions & 0 deletions benchmark/ICSharpCode.SharpZipLib.Benchmark/Zip/ZipOutputStream.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.IO;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;

namespace ICSharpCode.SharpZipLib.Benchmark.Zip
Expand Down Expand Up @@ -37,5 +38,25 @@ public long WriteZipOutputStream()
return memoryStream.Position;
}
}

[Benchmark]
public async Task<long> WriteZipOutputStreamAsync()
{
using (var memoryStream = new MemoryStream(outputBuffer))
{
using (var zipOutputStream = new SharpZipLib.Zip.ZipOutputStream(memoryStream))
{
zipOutputStream.IsStreamOwner = false;
zipOutputStream.PutNextEntry(new SharpZipLib.Zip.ZipEntry("0"));

for (int i = 0; i < ChunkCount; i++)
{
await zipOutputStream.WriteAsync(inputBuffer, 0, inputBuffer.Length);
}
}

return memoryStream.Position;
}
}
}
}