Files
hakorune/docs/development/roadmap/phases/phase-21.5-optimization/README.md

32 lines
1.2 KiB
Markdown
Raw Normal View History

# Phase 21.5 — Optimization (ny-llvm crate line)
Scope
- Optimize hot paths for the crate (ny-llvmc) line using Hakorune scripts only.
- Preserve default behavior; all risky changes behind dev toggles.
- Measure EXE runtime (build once, run many) to avoid toolchain overhead noise.
Targets (initial)
- loop: integer accumulations (no I/O)
- strlen: FAST=1 path (pointer → nyrt_string_length)
- box: construct/destroy minimal boxes (String/Integer)
Methodology
- Build once via ny-llvmc; time execution only (`--exe` mode).
- Runs: 35; report median and average (target ≥ 100ms per run).
- Observe NYASH_VM_STATS=1 (inst/compare/branch) where relevant to correlate structure and runtime.
Commands (examples)
- tools/perf/phase215/bench_loop.sh --runs 5
- tools/perf/phase215/bench_strlen.sh --runs 5 --fast 1
- tools/perf/phase215/run_all.sh --runs 5 --timeout 120
Dev Toggles (keep OFF by default)
- NYASH_LLVM_FAST=1 (strlen FAST)
- HAKO_MIR_BUILDER_JSONFRAG_NORMALIZE=1 (normalize)
- HAKO_MIR_BUILDER_NORMALIZE_TAG=1 (tag, test-only)
Exit Criteria
- Representative microbenches stable (≤ 5% variance) and ≥ 80% of C baselines.
- No regression in EXE canaries (loop/print/strlen FAST) and VM parity canaries.