multiformats / multiformats/py-multihash
No benchmark tests for `sum()`, `encode()`, `decode()` operations
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17
- Forks
- 17
- Avg merge
- 1h 5m
- Merged PRs (30d)
- 3
Description
There are no benchmark tests. go-multihash includes BenchmarkSum, BenchmarkEncode, BenchmarkDecode, BenchmarkBlake2B, and BenchmarkSumAllLarge which help catch performance regressions.
Problem
The test suite has functional tests but zero benchmarks. Operations like Blake2b hashing (which has 64 variants) and SHAKE variable-length hashing have no performance baseline.
Proposed Solution
-
Install
pytest-benchmarkas a dev dependency. -
Create
tests/test_benchmarks.py:import pytest from multihash import sum, encode, decode, Func BENCH_DATA = b"benchmark test data for multihash operations" * 100 @pytest.mark.benchmark def test_bench_sum_sha256(benchmark): benchmark(sum, BENCH_DATA, Func.sha2_256) @pytest.mark.benchmark def test_bench_sum_sha512(benchmark): benchmark(sum, BENCH_DATA, Func.sha2_512) @pytest.mark.benchmark def test_bench_sum_blake3(benchmark): benchmark(sum, BENCH_DATA, Func.blake3) @pytest.mark.benchmark @pytest.mark.parametrize("bits", [8, 128, 256, 384, 512]) def test_bench_sum_blake2b(benchmark, bits): func = getattr(Func, f"blake2b_{bits}") benchmark(sum, BENCH_DATA, func) @pytest.mark.benchmark def test_bench_encode(benchmark): digest = sum(BENCH_DATA, Func.sha2_256) benchmark(digest.encode) @pytest.mark.benchmark def test_bench_decode(benchmark): encoded = sum(BENCH_DATA, Func.sha2_256).encode() benchmark(decode, encoded)
Related
- Go benchmarks: go-multihash
sum_test.go,multihash_test.go
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Add pytest-benchmark as a development dependency, then create tests/test_benchmarks.py with the benchmark cases and parameters shown in the issue. Start by checking the existing test and dependency setup, then run the benchmark-marked tests. Done means sum(), encode(), decode(), and the listed hash variants have repeatable benchmark coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance, testing
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100