SQ
squeek502/zig-zstd-benchmark
WIP Zig std Zstandard benchmark
Setup
- Clone with submodules:
git clone --recurse-submodules https://github.com/UltraGreed/zig-zstd-benchmarkor clone as usual and pull submodules:
git clone https://github.com/UltraGreed/zig-zstd-benchmark
cd zig-zstd-benchmark
git submodule init
git submodule update- Build zstd library:
cd zstd
make
cd -- (Optional) Setup python environment for utils:
python -m venv .venv
source .venv/bin/activate
pip install tqdm bokehUsage
- (Optional) Compress files with python script:
utils/zstd_compress_dir.py PATH_RAW_DIR PATH_COMP_DIRThis will compress all the files in PATH_RAW_DIR with all compression levels from -7 to 19, and save them
as PATH_COMP_DIR/LEVEL/*.zst.
- Set path constants in the main of
src/zstd_bench.zig. The compressed data path should contain
subdirectories named after the respective compression levels, e.g.PATH_COMP_DIR/7/silesia.zst. - Build and run:
zig build -Doptimize=ReleaseFast runBenchmarking results will be saved in out/runs.csv file.
- (Optional) Plot results with python script:
utils/plot_results.pyGenerated plot will be saved as utils/plot_results.html and automatically opened in default browser.
Datasets used
Results
NOTE: This work is currently WIP and the produced results may not be 100% correct
Benchmarking is done on Gentoo/Linux x86_64 machine with AMD Ryzen 5 5600X CPU, Zig v0.15.2, Zstd v1.5.7.
