Skip to content

Commit e36676c

Browse files
committed
Replaces LZ4 and Zstd compression libraries with faster alternatives.
1 parent c2200a5 commit e36676c

28 files changed

+72
-4356
lines changed

src/3rdParty/LZ4/LICENSE

-67
This file was deleted.

src/3rdParty/ZstdSharp/LICENSE

-21
This file was deleted.

src/Playground/Benchmark/ZoneTreeTestBase.cs

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public class ZoneTreeTestBase
1616

1717
public CompressionMethod CompressionMethod { get; set; } = CompressionMethod.LZ4;
1818

19+
public int CompressionLevel { get; set; } = CompressionLevels.LZ4Fastest;
20+
1921
protected string GetLabel(string label)
2022
{
2123
return $"{WALMode} {label}" +

src/Playground/Program.cs

+16-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
TestConfig.MutableSegmentMaxItemCount = 1_000_000;
1212
TestConfig.ThresholdForMergeOperationStart = 2_000_000;
1313
TestConfig.RecreateDatabases = true;
14-
TestConfig.EnableParalelInserts = true;
14+
TestConfig.EnableParalelInserts = false;
1515
TestConfig.DiskSegmentMaximumCachedBlockCount = 1;
1616
TestConfig.DiskCompressionBlockSize = 1024 * 1024 * 10;
1717
TestConfig.WALCompressionBlockSize = 1024 * 32 * 8;
@@ -45,44 +45,49 @@
4545
var b = new Benchmark();
4646
var test1 = new ZoneTreeTest1();
4747
var test2 = new ZoneTreeTest2();
48-
var methods = new CompressionMethod[]
48+
var methods = new (CompressionMethod method, int level)[]
4949
{
50-
CompressionMethod.None,
51-
CompressionMethod.LZ4,
52-
CompressionMethod.Brotli,
53-
CompressionMethod.Zstd,
54-
CompressionMethod.Gzip
50+
(CompressionMethod.LZ4, CompressionLevels.LZ4Fastest),
51+
(CompressionMethod.Zstd, CompressionLevels.Zstd0),
52+
(CompressionMethod.Brotli, CompressionLevels.BrotliFastest),
53+
(CompressionMethod.Gzip, CompressionLevels.GzipFastest),
54+
(CompressionMethod.None, 0),
5555
};
56+
5657
test2.Count = test1.Count = 5_000_000;
5758
test2.WALMode = test1.WALMode = WriteAheadLogMode.None;
5859

5960
b.NewSection("int-int insert");
60-
foreach(var method in methods)
61+
foreach(var (method, level) in methods)
6162
{
6263
test1.CompressionMethod = method;
64+
test1.CompressionLevel = level;
6365
var stats = b.Run(test1.Insert);
6466
test1.AddDatabaseFileUsage(stats);
6567
}
6668

6769
b.NewSection("str-str insert");
68-
foreach (var method in methods)
70+
foreach (var (method, level) in methods)
6971
{
7072
test2.CompressionMethod = method;
73+
test2.CompressionLevel = level;
7174
var stats = b.Run(test2.Insert);
7275
test2.AddDatabaseFileUsage(stats);
7376
}
7477

7578
b.NewSection("int-int iterate");
76-
foreach (var method in methods)
79+
foreach (var (method, level) in methods)
7780
{
7881
test1.CompressionMethod = method;
82+
test1.CompressionLevel = level;
7983
b.Run(test1.Iterate);
8084
}
8185

8286
b.NewSection("str-str iterate");
83-
foreach (var method in methods)
87+
foreach (var (method, level) in methods)
8488
{
8589
test2.CompressionMethod = method;
90+
test2.CompressionLevel = level;
8691
b.Run(test2.Iterate);
8792
}
8893

0 commit comments

Comments
 (0)