Pi-Bolt 0.2.0 closes the last CPU gap with stock Bun: while replies stream, Pi-Bolt now uses less CPU than Bun's fully warmed-up JIT. It runs Pi 1.0.0.
| Pi-Bolt 0.2.0 | Bun 1.4.2 | Node 22 | |
|---|---|---|---|
| Interactive launch, ready to type | 83 ms | 123 ms | 296 ms |
| CPU for a 5-prompt session | 395 ms | 831 ms | 1,237 ms |
| CPU while replies stream (tmux) | 482 ms | 531 ms | 618 ms |
| Per prompt late in a 2.7M-token session | 146 ms | 188 ms | 247 ms |
| Own memory after that session | 126 MB | 289 MB | 474 MB |
Charts, method and raw data: docs/BENCHMARKS.md.
What changed
A profile of the TUI while replies stream showed Pi-Bolt spending 8% of its CPU calling the native charCodeAt once per character, from pi-tui's line-width measurement. Engine fixes (patches/webkit/0002):
- Integers boxed as int32. Numbers the compiler holds as doubles are now boxed as int32 whenever they are integers, as JavaScriptCore's
jsNumber()does. A loop counter updated withi += f()no longer falls off every int32 fast path. - Substrings.
charAtandcharCodeAtresolve substrings fromslice()/split()in place, so the compiled fast paths apply to them. - Faster loops with calls. The loop-splitting mode that also covers loops calling known functions is fixed and on by default. A spread call in a split loop was miscompiled; JavaScriptCore's test suite now gives the same results with this mode as without it.
Streaming CPU: 531 → 482 ms. pi-tui's width loop on its own: 25 → 6.3 ms.
Also new
bench/run-suite.shreproduces every published figure, andbench/report.pydraws the charts.bench/plugin_bench.pycompares plugins compiled in with plugins loaded at run time.- Regression tests for the fixes are in
tests/aot/. - docs/BENCHMARKS.md answers why a run-time plugin is slow on the JIT-off build, and whether the production build got slower (it did not).
Install
curl -fsSL https://pi-bolt.opensec.in/install.sh | sh| Asset | For |
|---|---|
pi-bolt-linux-x64.tar.gz
| Recommended. CPUs with AVX2 (Intel Haswell 2013+, AMD Zen+). |
pi-bolt-linux-x64-baseline.tar.gz
| Any x86-64 CPU. |
pi-bolt-linux-x64-jit.tar.gz
| JIT also on, for plugins loaded at run time. |
pi-bolt-runtime-linux-x64.tar.gz
| The Pi-Bolt Bun runtime, for compiling plugins in. |
Linux x86-64 with glibc 2.17 or later. Tested on Ubuntu 20.04/22.04/24.04, Debian 11/12, Rocky Linux 8/9, CentOS 7 and Amazon Linux 2.