jadnohra/zig-crypto-bench
Crypto benchmarks: Zig vs Rust performance comparison.
Crypto benchmarks: Zig vs Rust performance comparison.
Cryptographic performance benchmarks across Zig stdlib and Rust implementations with hardware acceleration.
Supported platforms: Linux and macOS (x86_64, aarch64)
SHA-256: Secure Hash Algorithm 256-bit
std.crypto.hash.sha2.Sha256
sha2
crate with hardware accelerationSHA-512: Secure Hash Algorithm 512-bit
std.crypto.hash.sha2.Sha512
*sha2
crate with hardware acceleration* Zig's SHA-512 currently lacks hardware acceleration (#22266), resulting in expected performance differences.
Run benchmarks to generate timestamped results in results/
directory:
zig build bench -- --save-results
git clone https://github.com/yourusername/zig-crypto-bench
cd zig-crypto-bench
zig build bench
# Run all benchmarks with default settings (500 iterations, 50 warmup)
zig build bench
# Save timestamped results to results/ directory for contribution
zig build bench -- --save-results
# Run with custom iteration counts
zig build bench -- --iterations 2000 --warmup 200
# Generate JSON output for analysis
zig build bench -- --json > results.json
# Filter specific tests by size
zig build bench -- --filter 1MB
# Combined: save results with custom settings
zig build bench -- --save-results --iterations 1000 --warmup 100
Hardware Results: Help expand hardware coverage by contributing benchmark results from your system. Run with --save-results and submit the generated markdown files from the results/ directory.
Open Issues: Check the issues for tasks ranging from small improvements to major features.
Development Conventions:
std.debug.print("\n✓ Running: Test Name\n", .{});
(This is idiomatic in Zig as the test runner lacks built-in verbose output)