Thank you for your interest in contributing! This guide will help you add new benchmark implementations.
This benchmark suite compares programming language performance using identical algorithm implementations. All implementations must follow the exact same logic as reference implementations to ensure fair comparison.
- Check the implementation status table in README.md
- Find reference implementations in
langs/php/,langs/c-plus-plus/, orlangs/python/ - Implement the algorithm in your target language following the exact logic
- Test locally with Docker
- Submit a pull request
Before implementing, always study the reference implementations:
- Primary references:
langs/php/<algorithm>/<Name>.php,langs/c-plus-plus/<algorithm>/<Name>.cpp,langs/python/<algorithm>/<Name>.py - Use the EXACT same algorithm logic, loop structures, and data structures
- Match the operation order and mathematical calculations
✅ Required to match:
- Loop structures and iteration order
- Mathematical operations in the same sequence
- Data structures (use arrays, not specialized structures)
- Algorithm flow and branching logic
- Variable naming patterns (where possible)
✅ Allowed adaptations:
- Idiomatic syntax for loops (for vs while)
- Standard library I/O functions
- Type declarations as required by language
- Memory management as required by language
- Standard timing/benchmarking utilities
❌ Not allowed:
- SIMD instructions or vectorization
- Parallelizing sequential algorithms
- Specialized data structures not in reference
- Compiler directives or JIT-specific hints
- Library-optimized algorithm replacements
- Any optimizations not present in references
Place your implementation in:
langs/<language>/<algorithm>/<Name>.<ext>
For languages with multiple runtimes (Kotlin, Java), use suffixes:
- Example:
Simple-JVM.ktandSimple-Native.kt
- Must match the algorithm name exactly (case-sensitive)
- Examples:
Simple.rs,Atkin.go,Linpack.java
Add your implementation to langs/<language>/benchmark.yml:
files:
- algorithm/Name.extChange ❌ to ✅ in the implementation table for your algorithm.
Test your implementation locally before submitting:
# Test specific language
docker-compose run benchmark python3 ./benchmark.py run --lang <language> --output jsonl=./.results/results.jsonl
# Test specific algorithm
docker-compose run benchmark python3 ./benchmark.py run --script <algorithm>/<Name> --output jsonl=./.results/results.jsonlVerify:
- Implementation runs without errors
- Output format matches reference implementations
- Timing measurement works correctly
feat(<language>): add <algorithm>/<Name> benchmark
Examples:
feat(rust): add primes/Simple benchmarkfeat(go): add linpack/Linpack benchmark
Your PR should include:
- Implementation file in correct directory
- Update to
benchmark.yml - Update to README.md implementation table
- Clear description of how you verified exact logic match
The benchmark suite includes:
- collatz/MaxSequence – Find number below limit with longest Collatz sequence
- linpack/Linpack – Solve dense system of linear equations (LINPACK benchmark)
- mandelbrot/Simple – Render ASCII Mandelbrot set
- primes/Atkin – Generate primes using Sieve of Atkin
- primes/Simple – Generate primes via trial division
- recursion/Tak – Compute Tak function (deep recursion test)
- treap/Naive – Treap data structure with inserts/deletes
- ❌ Not studying reference implementations before coding
- ❌ Using language-specific optimizations
- ❌ Forgetting to update README.md table
- ❌ Not testing with Docker before submitting
- ❌ Changing algorithm logic to be "more idiomatic"
- Check existing implementations in
langs/for examples - Review issue #65 for language-specific tracking issues
- Study reference implementations (PHP, C++, Python) carefully
Fairness over performance. Exact implementation over idiomatic code.
This benchmark exists to provide apples-to-apples comparison of programming language performance, not to showcase what each language can do when optimized.