-
Notifications
You must be signed in to change notification settings - Fork 976
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR #611: Bzip input stream simple vectorization
* Added benchmark for BZip2 decompression. * Updated benchmarks to be run also on .NET Core 3.1. * Simple automatic vectorization of the rotation loop. * Added comment describing vectorization.
- Loading branch information
1 parent
5eea92a
commit 1b9fcfc
Showing
4 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
benchmark/ICSharpCode.SharpZipLib.Benchmark/BZip2/BZip2InputStream.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.IO; | ||
using BenchmarkDotNet.Attributes; | ||
|
||
namespace ICSharpCode.SharpZipLib.Benchmark.BZip2 | ||
{ | ||
[Config(typeof(MultipleRuntimes))] | ||
public class BZip2InputStream | ||
{ | ||
private byte[] compressedData; | ||
|
||
public BZip2InputStream() | ||
{ | ||
var outputMemoryStream = new MemoryStream(); | ||
using (var outputStream = new SharpZipLib.BZip2.BZip2OutputStream(outputMemoryStream)) | ||
{ | ||
var random = new Random(1234); | ||
var inputData = new byte[1024 * 1024 * 30]; | ||
random.NextBytes(inputData); | ||
var inputMemoryStream = new MemoryStream(inputData); | ||
inputMemoryStream.CopyTo(outputStream); | ||
} | ||
|
||
compressedData = outputMemoryStream.ToArray(); | ||
} | ||
|
||
[Benchmark] | ||
public void DecompressData() | ||
{ | ||
var memoryStream = new MemoryStream(compressedData); | ||
using (var inputStream = new SharpZipLib.BZip2.BZip2InputStream(memoryStream)) | ||
{ | ||
inputStream.CopyTo(Stream.Null); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters