| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
AI models default to Python. Python is often the wrong choice for performance-critical code. Pivot analyzes your slow Python/Ruby/JS, rewrites it to Go/Rust/C++, and proves the output is statistically identical.
$ naab-lang pivot.naab analyze app.py Hotspot: process_batch() — 847ms avg, called 10,000x/min Candidate: rewrite to Go $ naab-lang pivot.naab rewrite app.py:process_batch --target go --prove ✓ Rewrite complete ✓ Correctness verified (1,000 test cases, 99.99% parity) ✓ Speedup: 34x (847ms → 24ms)
3–60x speedups · 8 target languages · Statistical proof of correctness · Part of the NAAb ecosystem
See NAAb Pivot optimizing Python code to Go with proven performance improvements:
CPU-intensive computation running slowly in Python:
Visual benchmark showing the dramatic speedup:
Results:
Pivot achieved:
Try the demo yourself:
cd demos
./pivot-demo.shSee DEMO_GUIDE.md for recording instructions.
# Clone with NAAb submodule
git clone --recursive https://github.com/b-macker/naab-pivot.git
cd naab-pivot
# Build NAAb language
bash build.sh
# Analyze slow code
./naab/build/naab-lang pivot.naab analyze slow.py
# Full evolution pipeline
./naab/build/naab-lang pivot.naab evolve slow.py --profile balancedInput (slow.py):
def heavy_computation(n):
result = 0.0
for i in range(n):
result += (i ** 2) ** 0.5
return result
# Baseline: 2843ms for n=10,000,000Run Pivot:
./naab/build/naab-lang pivot.naab evolve slow.pyOutput:
✓ Analysis complete: 1 function detected (complexity: 8) ✓ Generated optimized Go version ✓ Parity CERTIFIED (99.99% confidence, 100 test cases) ✓ Performance: 812ms (3.5x faster)
Generated Go code:
package main
import ("fmt"; "math"; "os"; "strconv")
func heavyComputation(n int) float64 {
result := 0.0
for i := 0; i < n; i++ {
result += math.Sqrt(math.Pow(float64(i), 2))
}
return result
}
func main() {
// Auto-generated vessel code...
}10 real-world examples with proven performance improvements:
| Example | Speedup | Description |
|---|---|---|
| 01. Basic Evolution | 3.5x | Python → Go loop optimization |
| 02. Batch Processing | 10x | Python → Rust ETL pipeline |
| 03. ML Optimization | 15x | Python → C++ inference |
| 04. Web Backend | 8x | Python → Go API (12K req/s) |
| 05. Crypto Mining | 18x | Python → Rust+SIMD |
| 06. Data Pipeline | 10x | Python → C++ analytics |
| 07. Scientific Computing | 60x | Python → Julia+GPU |
| 08. Embedded System | 15x | Python → Zig (96% less memory) |
| 09. Incremental Migration | N/A | 156K LOC enterprise guide |
| 10. Polyglot Microservices | 7.1x | Mixed stack ($1,800/mo savings) |
See examples/ for complete code and benchmarks.
ultra-safe conservative balanced aggressive experimental minimal embedded wasm
go cpp rust ruby javascript php zig julia
JSON HTML CSV SARIF Markdown
Use NAAb Pivot in your CI/CD pipeline:
name: Optimize Performance
on: [push, pull_request]
jobs:
evolve:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: b-macker/naab-pivot@v1
with:
file: src/critical_path.py
profile: balanced
validate: true
- name: Check Results
run: cat vessels/benchmark-report.jsonSource Code (Python/Ruby/JS)
|
Analyzer (AST parsing, complexity analysis)
|
Synthesizer (template-based code generation)
|
Compiler (parallel builds with caching)
|
Validator (statistical parity testing)
|
Benchmark (performance tracking)
|
Report (JSON/HTML/CSV/SARIF/Markdown)
NAAb Pivot is part of the NAAb ecosystem:
Contributions are welcome! See CONTRIBUTING.md for build instructions and guidelines.
MIT License - see LICENSE for details.
Brandon Mackert - @b-macker
NAAb Pivot — Polyglot evolution made simple.
| Back | FazBrowse Home | New Git URL |