Skip to content

Commit

Permalink
Merge pull request dotnet#21050 from Vedin/master
Browse files Browse the repository at this point in the history
Fix DeflateStream Performance test
  • Loading branch information
Ian Hays authored Jun 14, 2017
2 parents eb2f543 + 4099505 commit 051883e
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,24 @@ public enum CompressionType
NormalData = 4
}

[Benchmark]
private const int Iter = 1000;

[Benchmark(InnerIterationCount = Iter)]
[InlineData(CompressionType.CryptoRandom)]
[InlineData(CompressionType.RepeatedSegments)]
[InlineData(CompressionType.NormalData)]
public async Task Decompress(CompressionType type)
{
string testFilePath = CreateCompressedFile(type);
int _bufferSize = 1024;
int retCount = -1;
var bytes = new byte[_bufferSize];
using (MemoryStream gzStream = await LocalMemoryStream.readAppFileAsync(testFilePath))
using (MemoryStream strippedMs = StripHeaderAndFooter.Strip(gzStream))
foreach (var iteration in Benchmark.Iterations)
using (iteration.StartMeasurement())
for (int i = 0; i < 10000; i++)
for (int i = 0; i < Benchmark.InnerIterationCount; i++)
{
int retCount = -1;
using (DeflateStream zip = new DeflateStream(strippedMs, CompressionMode.Decompress, leaveOpen: true))
{
while (retCount != 0)
Expand Down

0 comments on commit 051883e

Please sign in to comment.