File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
benchmark/ICSharpCode.SharpZipLib.Benchmark/Zip Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -253,3 +253,4 @@ paket-files/
253253/test /ICSharpCode.SharpZipLib.TestBootstrapper /Properties /launchSettings.json
254254_testRunner /
255255docs /help /api /.manifest
256+ /benchmark /ICSharpCode.SharpZipLib.Benchmark /BenchmarkDotNet.Artifacts /results
Original file line number Diff line number Diff line change 11using System ;
22using System . IO ;
3+ using System . Threading . Tasks ;
34using BenchmarkDotNet . Attributes ;
45
56namespace ICSharpCode . SharpZipLib . Benchmark . Zip
@@ -37,5 +38,25 @@ public long WriteZipOutputStream()
3738 return memoryStream . Position ;
3839 }
3940 }
41+
42+ [ Benchmark ]
43+ public async Task < long > WriteZipOutputStreamAsync ( )
44+ {
45+ using ( var memoryStream = new MemoryStream ( outputBuffer ) )
46+ {
47+ using ( var zipOutputStream = new SharpZipLib . Zip . ZipOutputStream ( memoryStream ) )
48+ {
49+ zipOutputStream . IsStreamOwner = false ;
50+ zipOutputStream . PutNextEntry ( new SharpZipLib . Zip . ZipEntry ( "0" ) ) ;
51+
52+ for ( int i = 0 ; i < ChunkCount ; i ++ )
53+ {
54+ await zipOutputStream . WriteAsync ( inputBuffer , 0 , inputBuffer . Length ) ;
55+ }
56+ }
57+
58+ return memoryStream . Position ;
59+ }
60+ }
4061 }
4162}
You can’t perform that action at this time.
0 commit comments