Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch decompression buffer and op to use ref byte (#51)
Motivation ---------- Eliminate decompression pinning which can help with GC when compression/decompression is run a lot. GC will be able to move memory even when in the middle of a compression or decompression run and update the ref pointers. Modifications ------------- Switch all usages of buffer, bufferEnd, and op to be `ref byte`. Results ------- Neutral or a performance improvement across all platforms. This also finishes eliminating pinning for decompression. BenchmarkDotNet=v0.13.4, OS=Windows 11 (10.0.22000.1455/21H2) Intel Core i7-10850H CPU 2.70GHz, 1 CPU, 12 logical and 6 physical cores .NET SDK=7.0.102 [Host] : .NET 7.0.2 (7.0.222.60605), X64 RyuJIT AVX2 MediumRun-.NET 6.0 : .NET 6.0.13 (6.0.1322.58009), X64 RyuJIT AVX2 MediumRun-.NET 7.0 : .NET 7.0.2 (7.0.222.60605), X64 RyuJIT AVX2 MediumRun-.NET Framework 4.8 : .NET Framework 4.8 (4.8.4515.0), X64 RyuJIT VectorSize=256 IterationCount=15 LaunchCount=2 WarmupCount=10 | Method | Job | Runtime | Mean | Error | StdDev | Median | Ratio | RatioSD | Code Size | |-------- |----------------------------- |------------------- |----------:|---------:|---------:|----------:|------:|--------:|----------:| | Pointer | MediumRun-.NET 6.0 | .NET 6.0 | 101.02 us | 0.460 us | 0.660 us | 100.74 us | 1.00 | 0.00 | 5,784 B | | Ref | MediumRun-.NET 6.0 | .NET 6.0 | 95.49 us | 0.446 us | 0.626 us | 95.63 us | 0.95 | 0.00 | 5,836 B | | | | | | | | | | | | | Pointer | MediumRun-.NET 7.0 | .NET 7.0 | 86.22 us | 0.749 us | 1.097 us | 85.74 us | 1.00 | 0.00 | 4,609 B | | Ref | MediumRun-.NET 7.0 | .NET 7.0 | 87.46 us | 1.091 us | 1.634 us | 86.54 us | 1.01 | 0.02 | 4,532 B | | | | | | | | | | | | | Pointer | MediumRun-.NET Framework 4.8 | .NET Framework 4.8 | 105.81 us | 1.126 us | 1.685 us | 104.87 us | 1.00 | 0.00 | 6,015 B | | Ref | MediumRun-.NET Framework 4.8 | .NET Framework 4.8 | 98.72 us | 1.483 us | 2.174 us | 99.05 us | 0.93 | 0.03 | 5,918 B |
- Loading branch information