You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f56afe2
Browse filesBrowse the repository at this point in the historyBrowse files
perf(arith): improve arithmetic op speed vs PUC-Lua (#1)
* perf(arith): scaffold arith-vs-puc speedup work
- seed branch to close the arithmetic speed gap against PUC-Lua
- empty seed commit to open the Draft PR (CI, multi-machine sync);
real changes land in follow-up commits
Tags: #perf #arith #puc
Co-Authored-By: htjulia <htjulia1@gmail.com>
* perf(vm): inline monomorphic arith/bit fast paths
- the ADD/SUB/MUL/bit/ADDI opcodes shared generic helpers (arithIF,
arithBit, arithImm) that took the int/float op as a function-pointer
argument; Go cannot inline through an indirect call, so every hot
arithmetic op paid two non-inlined calls (the helper + the op itself)
- replace them with per-op monomorphic helpers (addIF/subIF/mulIF,
bandIF/borIF/bxorIF/shlIF/shrIF, addImm) that name the op directly,
letting iAdd/fAdd/… inline as direct calls; int-wrap and float
semantics stay bit-identical, so behavior is unchanged
- arith 4M-float loop drops 1.90x -> 1.45x vs PUC 5.4.8 (166.9->131.8ms,
-21%) on M2 Max; string-heavy workload unmoved (no regression)
- drop the now-unused generic helpers
Tags: #perf #arith #vm #puc
Co-Authored-By: htjulia <htjulia1@gmail.com>
* docs(bench): re-base cross-engine table on steady-state runs
- the published ratios were measured at workloads short enough (8-60ms)
that fixed costs (state init, first GC cycle, os.clock resolution)
inflated them - a 20k-node tree_build read as ~1.8x when its
steady-state cost is ~1.2x
- scale tree_build (20k->200k nodes) and string_build (120k->1.2M) so each
pass runs ~100ms+, measuring throughput rather than startup
- refresh BENCHMARKS.md to the Intel i7-4790K @06d1c54 long-run numbers:
tree 1.24x / arith 2.19x / string 1.31x vs PUC 5.4.8; note why short
runs mislead and that arith inlining closed ~2.45x->2.19x
- align README/ROADMAP wording (~1.2-1.3x table/string, ~2.2x arith) and
log the arith fast-path perf win under CHANGELOG Unreleased
Tags: #docs #bench #perf #puc
Co-Authored-By: htjulia <htjulia1@gmail.com>
* perf(strlib): pool matchState for find/match/gsub
- each find/match/gsub call allocated a fresh matchState - a struct with
a fixed maxCaptures array plus two string->[]byte conversions - which
showed up as ~6% of allocations and ~17% of byte churn on pattern-heavy
string workloads
- recycle call-scoped matchStates through a sync.Pool, reusing the
capture array and the src/pat byte buffers; only the LState reference is
dropped on release so a pooled state never pins it
- gmatch is left on the plain allocator on purpose: its matchState escapes
into the returned iterator closure and outlives the call
- StringHeavyExec: B/op -17%, allocs -6% (benchstat n=6); wall-clock
neutral, as the workload is CPU/GC-scan bound. captures and replacements
copy out of src, so reusing the backing after release is safe
- race clean, conformance 30/33 unchanged (pm.lua / strings.lua pass)
Tags: #perf #strlib #alloc
Co-Authored-By: htjulia <htjulia1@gmail.com>
* docs(changelog): cut 0.1.1 release notes
- promote the Unreleased perf work to a dated [0.1.1] section and reset
Unreleased to Planned only, ahead of tagging main after this merges
- record both perf changes (arith/bit inline, matchState pooling) plus the
benchmark re-base and the community-health docs that 0.1.1 will ship
- patch bump: performance + docs only, no API or behaviour change (30/33)
Tags: #docs #changelog #release
Co-Authored-By: htjulia <htjulia1@gmail.com>
| golua |`aarzilli/golua` (cgo) against Homebrew `lua@5.4` (Lua 5.4.8), built `-tags "lua54 llua"`|
55
-
| method | same self-timed `.lua` on each engine; **best of 7**`os.clock()` CPU-time runs |
63
+
| method | same self-timed `.lua` on each engine; **best of 7**`os.clock()` CPU-time runs, cross-checked back-to-back over several rounds; workloads sized to ~100 ms+ per pass|
0 commit comments