slovo/benchmarks/parse-loop/README.md
2026-05-22 08:38:43 +02:00

35 lines
1.5 KiB
Markdown

# Parse Loop Benchmark Scaffold
Release: `exp-40`; Common Lisp/SBCL comparison added by `exp-41`; hot-loop
mode added by `exp-42`.
This benchmark compares repeated signed decimal `i32` parsing across Slovo, C,
Rust, Python, Clojure, and Common Lisp/SBCL on the same machine.
It is not a published benchmark result, performance threshold, optimizer
claim, or cross-machine comparison.
All implementations print checksum `345000001` for loop count `1000000` and
parse text `12345`. Hot-loop mode uses loop count `10000000` and checksum
`450000001`. The runner supplies the loop count and parse text at runtime.
## Comparison Method
- The runner builds each implementation once before timing. The reported
numbers measure execution only, not compile time.
- Slovo timings use `glagol build`, which currently lowers to LLVM and then
invokes host `clang -O2` with `runtime/runtime.c`.
- C timings use `clang -O2 -std=c11`.
- Rust timings use `rustc -C opt-level=3 -C debuginfo=0`.
- The parse implementations are intentionally comparable by input and checksum,
not identical by parser internals: Slovo uses `std.string.parse_i32_result`,
C uses `strtol`, Rust uses `parse::<i32>()`, Python uses `int`, Clojure uses
`Integer/parseInt`, and Common Lisp uses `parse-integer`.
Timing is cold-process local-machine evidence only. Clojure timings include
JVM and Clojure startup, while Common Lisp timings include SBCL script
startup.
Hot-loop mode is startup-amortized local evidence. It reports total time plus
normalized time for the base `1000000` loop count.