Skip to content

Commit 1199c5d

Browse files
committed
Updated packages and documentation
- Updated the unit test projects - bypassing XUnit V3 version 2.0 for now as there seems to be some bugs involved. - Updated the runtime package reference versions to the latest. - Updated package versions to fix some dependency issues and updated tests to add a trait for explicit tests to filter those as needed. - Refactor memory stream options for better DocFx output - Introduced a new property group in `Directory.Build.props` for documentation generation and artifact output settings. - Updated references in `MemoryStreamDeflateOptionsExtensions.cs`, `MemoryStreamGZipOptionsExtensions.cs`, and `MemoryStreamZLibOptionsExtensions.cs` from `MemoryStream*Options` to `MemoryStreamZLibBaseOptions`. - Corrected method signature documentation for `CopyToAsync` in `MemoryStreamSlim.cs`. - Enhance compression options documentation. - Updated documentation for compression options, including notes on .NET 9.0 property availability. - Refactored compression unit tests with `using` statements. - Updated and cleaned up many benchmark files. - Added benchmark output files & updates articles. - Added compression benchmark result files. - Added compression related articles. - Updated some benchmarks to simplify the output and make the output easier to understand.
1 parent e5e6701 commit 1199c5d

78 files changed

Lines changed: 7990 additions & 7213 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ StyleCopReport.xml
9595
*.pidb
9696
*.svclog
9797
*.scc
98+
*.dll
9899

99100
# Chutzpah Test files
100101
_Chutzpah*
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) Kevin Zehrer
2+
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
3+
4+
using System.IO.Compression;
5+
6+
using KZDev.PerfUtils;
7+
8+
namespace Examples.Compression;
9+
10+
public class CompressionExample
11+
{
12+
public MemoryStreamSlim CompressData(byte[] data)
13+
{
14+
return MemoryStreamDeflate.Compress(data);
15+
}
16+
17+
public MemoryStreamSlim CompressDataWithSmallestSize(byte[] data)
18+
{
19+
return MemoryStreamDeflate.Compress(data, options => options.WithCompressionLevel(CompressionLevel.SmallestSize));
20+
}
21+
}

Source/Directory.Packages.props

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
<!--
33
Define repository level package version properties
44
-->
5-
<ItemGroup Label="PackageVersions">
5+
<ItemGroup Label="PackageVersions" Condition="'$(TargetFramework)' == 'net9.0'">
6+
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="9.0.3" />
7+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.3" />
8+
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.3" />
9+
</ItemGroup>
10+
<ItemGroup Label="PackageVersions" Condition="'$(TargetFramework)' != 'net9.0'">
611
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
712
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
813
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
```
2+
3+
BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.3775)
4+
Intel Core i9-14900K, 1 CPU, 32 logical and 24 physical cores
5+
.NET SDK 9.0.203
6+
[Host] : .NET 9.0.4 (9.0.425.16305), X64 RyuJIT AVX2
7+
DefaultJob : .NET 9.0.4 (9.0.425.16305), X64 RyuJIT AVX2
8+
9+
10+
```
11+
| Method | DataSize | CapacityOnCreate | Mean | Error | StdDev | Ratio | RatioSD | Gen0 | Gen1 | Gen2 | Allocated | Alloc Ratio |
12+
|-------------------------------------------------- |---------- |----------------- |---------------:|-------------:|-------------:|------:|--------:|----------:|----------:|----------:|--------------:|------------:|
13+
| **&#39;MemoryStream BrotliStream Compression&#39;** | **131072** | **False** | **1,265.1 μs** | **16.01 μs** | **14.19 μs** | **1.00** | **0.02** | **623.0469** | **623.0469** | **623.0469** | **2241.79 KB** | **1.000** |
14+
| &#39;RecyclableMemoryStream BrotliStream Compression&#39; | 131072 | False | 797.4 μs | 7.18 μs | 6.72 μs | 0.63 | 0.01 | - | - | - | 2.11 KB | 0.001 |
15+
| &#39;MemoryStreamSlim BrotliStream Compression&#39; | 131072 | False | 804.5 μs | 2.77 μs | 2.59 μs | 0.64 | 0.01 | - | - | - | 2.07 KB | 0.001 |
16+
| | | | | | | | | | | | | |
17+
| **&#39;MemoryStream BrotliStream Compression&#39;** | **131072** | **True** | **1,166.3 μs** | **6.63 μs** | **6.20 μs** | **1.00** | **0.01** | **623.0469** | **623.0469** | **623.0469** | **1921.67 KB** | **1.000** |
18+
| &#39;RecyclableMemoryStream BrotliStream Compression&#39; | 131072 | True | 788.5 μs | 7.57 μs | 7.08 μs | 0.68 | 0.01 | - | - | - | 2.11 KB | 0.001 |
19+
| &#39;MemoryStreamSlim BrotliStream Compression&#39; | 131072 | True | 784.9 μs | 2.72 μs | 2.54 μs | 0.67 | 0.00 | - | - | - | 2.07 KB | 0.001 |
20+
| | | | | | | | | | | | | |
21+
| **&#39;MemoryStream BrotliStream Compression&#39;** | **16777216** | **False** | **160,363.5 μs** | **3,118.43 μs** | **5,123.67 μs** | **1.00** | **0.04** | **4666.6667** | **4666.6667** | **4666.6667** | **327365.88 KB** | **1.000** |
22+
| &#39;RecyclableMemoryStream BrotliStream Compression&#39; | 16777216 | False | 122,424.4 μs | 1,118.25 μs | 991.30 μs | 0.76 | 0.02 | - | - | - | 364.39 KB | 0.001 |
23+
| &#39;MemoryStreamSlim BrotliStream Compression&#39; | 16777216 | False | 123,307.7 μs | 1,845.81 μs | 1,636.26 μs | 0.77 | 0.03 | - | - | - | 2.23 KB | 0.000 |
24+
| | | | | | | | | | | | | |
25+
| **&#39;MemoryStream BrotliStream Compression&#39;** | **16777216** | **True** | **144,735.8 μs** | **1,935.22 μs** | **1,510.89 μs** | **1.00** | **0.01** | **4750.0000** | **4750.0000** | **4750.0000** | **245767.18 KB** | **1.000** |
26+
| &#39;RecyclableMemoryStream BrotliStream Compression&#39; | 16777216 | True | 123,696.0 μs | 2,400.16 μs | 2,245.11 μs | 0.85 | 0.02 | - | - | - | 27.04 KB | 0.000 |
27+
| &#39;MemoryStreamSlim BrotliStream Compression&#39; | 16777216 | True | 122,721.4 μs | 1,680.01 μs | 1,489.28 μs | 0.85 | 0.01 | - | - | - | 2.3 KB | 0.000 |
28+
| | | | | | | | | | | | | |
29+
| **&#39;MemoryStream BrotliStream Compression&#39;** | **209715200** | **False** | **1,657,996.1 μs** | **17,018.54 μs** | **15,919.15 μs** | **1.00** | **0.01** | **3000.0000** | **3000.0000** | **3000.0000** | **2621125.72 KB** | **1.000** |
30+
| &#39;RecyclableMemoryStream BrotliStream Compression&#39; | 209715200 | False | 1,412,500.9 μs | 25,484.85 μs | 23,838.54 μs | 0.85 | 0.02 | 2000.0000 | - | - | 50534.08 KB | 0.019 |
31+
| &#39;MemoryStreamSlim BrotliStream Compression&#39; | 209715200 | False | 1,394,513.0 μs | 11,134.35 μs | 9,297.68 μs | 0.84 | 0.01 | - | - | - | 3 KB | 0.000 |
32+
| | | | | | | | | | | | | |
33+
| **&#39;MemoryStream BrotliStream Compression&#39;** | **209715200** | **True** | **1,623,939.0 μs** | **18,348.17 μs** | **17,162.89 μs** | **1.00** | **0.01** | **1000.0000** | **1000.0000** | **1000.0000** | **3072002.65 KB** | **1.000** |
34+
| &#39;RecyclableMemoryStream BrotliStream Compression&#39; | 209715200 | True | 1,393,359.5 μs | 17,534.00 μs | 15,543.43 μs | 0.86 | 0.01 | - | - | - | 315.02 KB | 0.000 |
35+
| &#39;MemoryStreamSlim BrotliStream Compression&#39; | 209715200 | True | 1,390,654.6 μs | 15,145.63 μs | 14,167.23 μs | 0.86 | 0.01 | - | - | - | 2.72 KB | 0.000 |
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!DOCTYPE html>
2+
<html lang='en'>
3+
<head>
4+
<meta charset='utf-8' />
5+
<title>MemoryStreamBenchmarks.BrotliCompressionThroughputBenchmarks-20250413-202010</title>
6+
7+
<style type="text/css">
8+
table { border-collapse: collapse; display: block; width: 100%; overflow: auto; }
9+
td, th { padding: 6px 13px; border: 1px solid #ddd; text-align: right; }
10+
tr { background-color: #fff; border-top: 1px solid #ccc; }
11+
tr:nth-child(even) { background: #f8f8f8; }
12+
</style>
13+
</head>
14+
<body>
15+
<pre><code>
16+
BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.3775)
17+
Intel Core i9-14900K, 1 CPU, 32 logical and 24 physical cores
18+
.NET SDK 9.0.203
19+
[Host] : .NET 9.0.4 (9.0.425.16305), X64 RyuJIT AVX2
20+
DefaultJob : .NET 9.0.4 (9.0.425.16305), X64 RyuJIT AVX2
21+
</code></pre>
22+
<pre><code></code></pre>
23+
24+
<table>
25+
<thead><tr><th>Method </th><th>DataSize</th><th>CapacityOnCreate</th><th>Mean </th><th>Error </th><th>StdDev</th><th>Ratio</th><th>RatioSD</th><th>Gen0</th><th>Gen1</th><th>Gen2</th><th>Allocated</th><th>Alloc Ratio</th>
26+
</tr>
27+
</thead><tbody><tr><td>&#39;MemoryStream BrotliStream Compression&#39;</td><td>131072</td><td>False</td><td>1,265.1 &mu;s</td><td>16.01 &mu;s</td><td>14.19 &mu;s</td><td>1.00</td><td>0.02</td><td>623.0469</td><td>623.0469</td><td>623.0469</td><td>2241.79 KB</td><td>1.000</td>
28+
</tr><tr><td>&#39;RecyclableMemoryStream BrotliStream Compression&#39;</td><td>131072</td><td>False</td><td>797.4 &mu;s</td><td>7.18 &mu;s</td><td>6.72 &mu;s</td><td>0.63</td><td>0.01</td><td>-</td><td>-</td><td>-</td><td>2.11 KB</td><td>0.001</td>
29+
</tr><tr><td>&#39;MemoryStreamSlim BrotliStream Compression&#39;</td><td>131072</td><td>False</td><td>804.5 &mu;s</td><td>2.77 &mu;s</td><td>2.59 &mu;s</td><td>0.64</td><td>0.01</td><td>-</td><td>-</td><td>-</td><td>2.07 KB</td><td>0.001</td>
30+
</tr><tr><td>&#39;MemoryStream BrotliStream Compression&#39;</td><td>131072</td><td>True</td><td>1,166.3 &mu;s</td><td>6.63 &mu;s</td><td>6.20 &mu;s</td><td>1.00</td><td>0.01</td><td>623.0469</td><td>623.0469</td><td>623.0469</td><td>1921.67 KB</td><td>1.000</td>
31+
</tr><tr><td>&#39;RecyclableMemoryStream BrotliStream Compression&#39;</td><td>131072</td><td>True</td><td>788.5 &mu;s</td><td>7.57 &mu;s</td><td>7.08 &mu;s</td><td>0.68</td><td>0.01</td><td>-</td><td>-</td><td>-</td><td>2.11 KB</td><td>0.001</td>
32+
</tr><tr><td>&#39;MemoryStreamSlim BrotliStream Compression&#39;</td><td>131072</td><td>True</td><td>784.9 &mu;s</td><td>2.72 &mu;s</td><td>2.54 &mu;s</td><td>0.67</td><td>0.00</td><td>-</td><td>-</td><td>-</td><td>2.07 KB</td><td>0.001</td>
33+
</tr><tr><td>&#39;MemoryStream BrotliStream Compression&#39;</td><td>16777216</td><td>False</td><td>160,363.5 &mu;s</td><td>3,118.43 &mu;s</td><td>5,123.67 &mu;s</td><td>1.00</td><td>0.04</td><td>4666.6667</td><td>4666.6667</td><td>4666.6667</td><td>327365.88 KB</td><td>1.000</td>
34+
</tr><tr><td>&#39;RecyclableMemoryStream BrotliStream Compression&#39;</td><td>16777216</td><td>False</td><td>122,424.4 &mu;s</td><td>1,118.25 &mu;s</td><td>991.30 &mu;s</td><td>0.76</td><td>0.02</td><td>-</td><td>-</td><td>-</td><td>364.39 KB</td><td>0.001</td>
35+
</tr><tr><td>&#39;MemoryStreamSlim BrotliStream Compression&#39;</td><td>16777216</td><td>False</td><td>123,307.7 &mu;s</td><td>1,845.81 &mu;s</td><td>1,636.26 &mu;s</td><td>0.77</td><td>0.03</td><td>-</td><td>-</td><td>-</td><td>2.23 KB</td><td>0.000</td>
36+
</tr><tr><td>&#39;MemoryStream BrotliStream Compression&#39;</td><td>16777216</td><td>True</td><td>144,735.8 &mu;s</td><td>1,935.22 &mu;s</td><td>1,510.89 &mu;s</td><td>1.00</td><td>0.01</td><td>4750.0000</td><td>4750.0000</td><td>4750.0000</td><td>245767.18 KB</td><td>1.000</td>
37+
</tr><tr><td>&#39;RecyclableMemoryStream BrotliStream Compression&#39;</td><td>16777216</td><td>True</td><td>123,696.0 &mu;s</td><td>2,400.16 &mu;s</td><td>2,245.11 &mu;s</td><td>0.85</td><td>0.02</td><td>-</td><td>-</td><td>-</td><td>27.04 KB</td><td>0.000</td>
38+
</tr><tr><td>&#39;MemoryStreamSlim BrotliStream Compression&#39;</td><td>16777216</td><td>True</td><td>122,721.4 &mu;s</td><td>1,680.01 &mu;s</td><td>1,489.28 &mu;s</td><td>0.85</td><td>0.01</td><td>-</td><td>-</td><td>-</td><td>2.3 KB</td><td>0.000</td>
39+
</tr><tr><td>&#39;MemoryStream BrotliStream Compression&#39;</td><td>209715200</td><td>False</td><td>1,657,996.1 &mu;s</td><td>17,018.54 &mu;s</td><td>15,919.15 &mu;s</td><td>1.00</td><td>0.01</td><td>3000.0000</td><td>3000.0000</td><td>3000.0000</td><td>2621125.72 KB</td><td>1.000</td>
40+
</tr><tr><td>&#39;RecyclableMemoryStream BrotliStream Compression&#39;</td><td>209715200</td><td>False</td><td>1,412,500.9 &mu;s</td><td>25,484.85 &mu;s</td><td>23,838.54 &mu;s</td><td>0.85</td><td>0.02</td><td>2000.0000</td><td>-</td><td>-</td><td>50534.08 KB</td><td>0.019</td>
41+
</tr><tr><td>&#39;MemoryStreamSlim BrotliStream Compression&#39;</td><td>209715200</td><td>False</td><td>1,394,513.0 &mu;s</td><td>11,134.35 &mu;s</td><td>9,297.68 &mu;s</td><td>0.84</td><td>0.01</td><td>-</td><td>-</td><td>-</td><td>3 KB</td><td>0.000</td>
42+
</tr><tr><td>&#39;MemoryStream BrotliStream Compression&#39;</td><td>209715200</td><td>True</td><td>1,623,939.0 &mu;s</td><td>18,348.17 &mu;s</td><td>17,162.89 &mu;s</td><td>1.00</td><td>0.01</td><td>1000.0000</td><td>1000.0000</td><td>1000.0000</td><td>3072002.65 KB</td><td>1.000</td>
43+
</tr><tr><td>&#39;RecyclableMemoryStream BrotliStream Compression&#39;</td><td>209715200</td><td>True</td><td>1,393,359.5 &mu;s</td><td>17,534.00 &mu;s</td><td>15,543.43 &mu;s</td><td>0.86</td><td>0.01</td><td>-</td><td>-</td><td>-</td><td>315.02 KB</td><td>0.000</td>
44+
</tr><tr><td>&#39;MemoryStreamSlim BrotliStream Compression&#39;</td><td>209715200</td><td>True</td><td>1,390,654.6 &mu;s</td><td>15,145.63 &mu;s</td><td>14,167.23 &mu;s</td><td>0.86</td><td>0.01</td><td>-</td><td>-</td><td>-</td><td>2.72 KB</td><td>0.000</td>
45+
</tr></tbody></table>
46+
</body>
47+
</html>

0 commit comments

Comments
 (0)