A polyglot benchmark suite demonstrating Ruchy's performance parity with Rust while maintaining Python-like ergonomics. Features real Ruchy formal verification and complexity analysis tools providing empirical evidence of zero-cost abstractions through systematic comparison across production workloads.
rosetta-ruchy/
βββ harness/ # Benchmark Infrastructure
β βββ runner/ # Statistical benchmark orchestrator
β β βββ src/main.rs # CLI tool for running benchmarks
β β βββ Cargo.toml # Runner dependencies & configuration
β βββ docker/ # Container orchestration (future)
βββ examples/ # Language implementations
β βββ algorithms/ # Classic CS problems
β β βββ 001-fibonacci/ # First benchmark example
β β βββ 002-quicksort/ # Sorting algorithms
β β βββ ...
β βββ production/ # Real-world workloads
βββ scripts/ # Quality & release automation
β βββ validation-tools/ # Rust-based validation utilities
β βββ pre-commit-hook.sh # Toyota Way quality gates
β βββ release.sh # Canonical version management
β βββ validate.sh # Comprehensive project validation
βββ docs/ # Documentation & specifications
βββ specifications/ # Complete project specification
βββ execution/ # Task roadmap & velocity tracking
The project enforces zero-tolerance quality standards through:
- Kaizen (ζΉε): Continuous improvement via complexity analysis
- Genchi Genbutsu (ηΎε°ηΎη©): Measure actual performance, don't guess
- Jidoka (θͺεε): Automated quality gates that stop the line for defects
- β Zero SATD Policy: No TODO/FIXME/HACK comments allowed
- β Complexity β€20: All functions under cognitive complexity threshold
- β Test Coverage β₯80%: Statistical significance required
- β
Zero Lint Warnings:
-D warnings
flag enforced - β Security Scan: Zero critical vulnerabilities
Every algorithm implementation demonstrates real Ruchy toolchain capabilities using the installed ruchy
binary (v1.7.0):
ruchy check algorithm.ruchy # β Syntax is valid
ruchy runtime algorithm.ruchy
# β‘ Basic Performance Metrics for algorithm.ruchy
# Total Functions: 1
# Recursive Functions: 0
# Loop Complexity Level: 0
# Estimated Runtime: O(1)
# Optimization Score: β
Well Optimized (100.0/100)
ruchy provability algorithm.ruchy
# π¬ Basic Provability Analysis for algorithm.ruchy
# Total Functions: 1
# Pure Functions: 1 (100.0%)
# Recursive Functions: 0
# Loops: 0
# Conditionals: 2
# Provability Score: β
High Provability (100.0/100)
ruchy score algorithm.ruchy
# Quality Score Report
# ==================================================
# Overall Score: 1.000 (A+)
# Confidence: 54.0%
#
# Component Breakdown:
# Correctness: 1.000 (35%)
# Performance: 1.000 (25%)
# Maintainability: 1.000 (20%)
# Safety: 1.000 (15%)
# Idiomaticity: 1.000 (5%)
ruchy ast algorithm.ruchy # Enhanced AST analysis
ruchy optimize algorithm.ruchy # Hardware-aware optimization
ruchy prove algorithm.ruchy # Interactive theorem prover
ruchy mcp algorithm.ruchy # Real-time quality analysis
ruchy quality-gate algorithm.ruchy # Quality gate enforcement
- Minimum 1000 iterations for statistical significance
- Confidence intervals with standard deviation analysis
- Performance regression detection (5% threshold)
- Memory profiling and binary size analysis
- CPU isolation with performance governor control
- Tier 1 (Full CI): Ruchy, Rust, Python, JavaScript, Go
- Tier 2 (Community): TypeScript, Java, C++, C#, Swift
- Tier 3 (Reference): Single implementations
Metric | Target | Current Status |
---|---|---|
Ruchy vs Rust | Within 5% for CPU tasks | π§ In Development |
Ruchy vs Python | 10-50x faster | π§ In Development |
Memory Usage | Β±10% of Rust baseline | π§ In Development |
Lines of Code | 30-50% fewer than Rust | π§ In Development |
Compilation Time | <100ms incremental | π§ In Development |
# Install development tools
make install-dev-tools
# Set up quality gates
make install-hooks
# Validate environment setup
make validate
# Run a specific example (when examples exist)
./target/debug/rosetta-runner run examples/algorithms/001-fibonacci --iterations 1000
# Compare results across languages
./target/debug/rosetta-runner compare results/ --html
# 1. Check current roadmap status
cat docs/execution/roadmap.md
# 2. Run quality gates before any changes
make quality-gate
# 3. Make changes following Toyota Way principles
# 4. Validate changes pass all gates
make lint && make test && make complexity
# 5. Commit with task reference
git commit -m "ROSETTA-XXX: Brief description"
Command | Purpose | Toyota Way Principle |
---|---|---|
make quality-gate |
Run all mandatory checks | Jidoka (Stop the line) |
make analyze-complexity |
Find complexity hotspots | Genchi Genbutsu (Go see) |
make refactor-plan FILE=<path> |
Generate improvement plan | Kaizen (Continuous improvement) |
make release-auto |
Create quality-assured release | Built-in quality |
Compare your favorite language with Ruchy side-by-side. All examples include performance benchmarks, advanced tooling analysis, and formal verification.
Language | Example | Ruchy Version | Advanced Tooling | Performance |
---|---|---|---|---|
π¦ Rust | fibonacci.rs |
fibonacci.ruchy |
AST Analysis β’ Provability β’ Quality Score | π β€5% difference |
π Python | fibonacci.py |
fibonacci.ruchy |
Zero-cost abstractions vs Python's runtime overhead | π 10-50x faster |
π¨ JavaScript | fibonacci.js |
fibonacci.ruchy |
Compile-time verification vs runtime type checking | π 5-20x faster |
πΉ Go | fibonacci.go |
fibonacci.ruchy |
Formal verification + mathematical proofs | β‘ 2-5x faster |
βοΈ C | fibonacci.c |
fibonacci.ruchy |
Memory safety without performance cost | π― Comparable speed |
π Python (Baseline) | π Ruchy (Advanced) | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
def fib_recursive(n: int) -> int:
"""Exponential complexity O(2^n)"""
if n <= 1:
return n
return fib_recursive(n - 1) + fib_recursive(n - 2)
def fib_iterative(n: int) -> int:
"""Linear complexity O(n)"""
if n <= 1:
return n
prev, curr = 0, 1
for _ in range(2, n + 1):
prev, curr = curr, prev + curr
return curr |
|
|||||||||||||||||||||
π§ͺ Advanced Tooling Comparison:
|
# Run any language implementation
cd examples/algorithms/001-fibonacci/implementations/
# Python version
python python/fibonacci.py 30 iterative
# Rust version
cargo run --manifest-path rust/Cargo.toml 30 iterative
# JavaScript version
node javascript/fibonacci.js 30 iterative
# Ruchy version (π₯ Advanced formal verification)
ruchy run ruchy/fibonacci.ruchy
Example: AST Analysis reveals optimization opportunities
# Comprehensive AST inspection with metrics
ruchy ast examples/algorithms/001-fibonacci/implementations/ruchy/fibonacci.ruchy --metrics
# β Complete syntax tree with complexity metrics
# β Cyclomatic complexity calculation
# β Symbol usage analysis with unused detection
# β Module dependency tracking
# JSON output for tooling integration
ruchy ast examples/algorithms/001-fibonacci/implementations/ruchy/fibonacci.ruchy --json --output ast.json
# β Machine-readable AST for CI/CD pipelines
Example: Formal Verification proves correctness
# Basic provability analysis (v0.11.3)
ruchy provability examples/algorithms/001-fibonacci/implementations/ruchy/fibonacci.ruchy
# β Function purity detection with side-effect analysis
# β Recursive function identification and complexity scoring
# β Provability scoring (0-100) with visual indicators
# Full formal verification with contracts
ruchy provability examples/algorithms/001-fibonacci/implementations/ruchy/fibonacci.ruchy --verify --contracts --termination
# β Mathematical proof of termination
# β Memory safety & bounds checking
# β Loop invariant checking
Example: Performance Analysis with BigO detection
# Automatic BigO algorithmic complexity detection (v0.11.3)
ruchy runtime examples/algorithms/001-fibonacci/implementations/ruchy/fibonacci.ruchy --bigo
# β Automatic BigO detection (O(1), O(n), O(nΒ²), O(nΒ³))
# β Nested loop complexity analysis with worst-case scenarios
# β Function-level profiling with execution timing
# Performance bottleneck identification
ruchy runtime examples/algorithms/001-fibonacci/implementations/ruchy/fibonacci.ruchy --profile --memory
# β Performance bottleneck identification
# β Memory usage analysis
# β Optimization scoring with specific recommendations
π Developer Note: Ruchy code blocks in this README use
rust
syntax highlighting for better readability until GitHub adds native Ruchy support. The ruchy-book project includes full highlight.js integration with proper Ruchy syntax highlighting for documentation sites.Contribute: Help us get Ruchy added to GitHub Linguist for official syntax highlighting support!
Phase 3: Data Science Migration to v1.89 β COMPLETED
- Complete migration of 12 data science examples to Ruchy v1.89.0
- Explicit mutability implementation across all algorithms
- Fixed-size array patterns replacing dynamic Vec collections
- Complex 2D/3D array structures for matrices and datasets
- 100% syntax validation success rate (12/12 examples pass
ruchy check
) - Statistical analysis, ML pipelines, computer vision, distributed computing
- Established v1.89 migration patterns for future development
Phase 2: Multi-Language MCP Server β COMPLETED
- Real-time code translation API (Rust, Python, JavaScript, Go, C β Ruchy)
- Advanced AST analysis and formal verification integration
- Multi-platform binary releases (Linux, macOS, Windows)
- Interactive PMCP translation with step-by-step feedback
- Production-ready MCP server with comprehensive documentation
Phase 1: Algorithm Examples β COMPLETED
- 22 classical computer science algorithms implemented and verified
- Perfect scores (0.975 A+, 100% provability) across all implementations
- Ruchy advanced tooling demonstrations (AST, provability, scoring)
- Performance benchmarking infrastructure with formal verification
- Quality analysis and optimization reports
Phase 0: Foundation Infrastructure β COMPLETED
- Repository structure & quality gates established
- Cargo workspace with statistical runner
- Toyota Way methodology integrated
- CI/CD pipeline with quality enforcement
Real-time code translation service with formal verification:
# Install MCP server (from GitHub releases)
curl -fsSL https://github.com/paiml/rosetta-ruchy/releases/download/v1.0.0/install.sh | sh
# Or install ruchy compiler directly from crates.io
cargo install ruchy
# Start translation server
rosetta-ruchy-mcp --host 127.0.0.1 --port 8080
# Translate code via API
curl -X POST http://localhost:8080/api/v1/translate \
-H "Content-Type: application/json" \
-d '{"source_code": "def hello(): print(\"Hello!\")", "source_language": "python"}'
See mcp-server/README.md for complete API documentation.
See docs/execution/roadmap.md for detailed progress tracking.
Advanced Quality Analysis: Rosetta-Ruchy integrates with PMAT (PAIML MCP Agent Toolkit) for comprehensive code quality analysis:
- π― Technical Debt Grading: Complete TDG analysis for all implementations
- π WASM Analysis: WebAssembly analysis for compiled Ruchy targets
- π€ MCP Tools: Real-time quality analysis through Model Context Protocol
- π Quality Correlation: Performance vs. quality correlation analytics
- π Toyota Way Alignment: Shared continuous improvement methodology
π Complete Integration Guide β
This project follows the Toyota Way methodology:
- Quality First: All contributions must pass zero-tolerance quality gates
- Continuous Improvement: Small, incremental changes preferred
- Measure Everything: Performance claims require benchmarks
- Stop the Line: Any quality violation blocks progress
See CONTRIBUTING.md for detailed guidelines.
MIT License - see LICENSE for details.
πΈ Built with Toyota Way principles: Quality built-in, not bolted-on