Skip to content

perf: avoid concat scratch string interning#126

Merged
ianm199 merged 1 commit into
mainfrom
perf/post-027-telemetry-wave
Jun 2, 2026
Merged

perf: avoid concat scratch string interning#126
ianm199 merged 1 commit into
mainfrom
perf/post-027-telemetry-wave

Conversation

@ianm199
Copy link
Copy Markdown
Owner

@ianm199 ianm199 commented Jun 2, 2026

Summary

  • add a safe two-operand string/number concat fast path that formats numeric operands into the final concat buffer instead of interning a temporary numeric Lua string first
  • add PROFILE_REPEAT=N support to hotspot, opcode, and GC profiling runners for short workload telemetry
  • include gc_pressure, mandelbrot_long, and table_hash_pressure in the dashboard workload registry
  • update performance docs with the concat finding and rejected VM/OP_MUL spikes

Evidence

Correctness:

  • make test passed, including 44/44 official Lua conformance tests

Benchmarks, Apple M3 Max, best-of-N vs Lua 5.4.7 reference:

  • focused best-of-10: table_hash_pressure 1.17x after the concat fast path (harness/bench/results/20260602T183040Z-98bd6bd-compare.tsv)
  • full best-of-5: table_hash_pressure 1.14x, overall 1.54x (harness/bench/results/20260602T183215Z-98bd6bd-compare.tsv)

Profile delta:

  • before: table_hash_pressure_x100 had lua_vm::vm::concat at 1,297 samples / 19.4% (harness/bench/profiles/20260602T182714Z-98bd6bd-table_hash_pressure_x100/summary.txt)
  • after: lua_vm::vm::concat dropped to 116 samples / 3.1% (harness/bench/profiles/20260602T183359Z-98bd6bd-table_hash_pressure_x100/summary.txt)

Negative results recorded in docs:

  • no-hook ci_trap guard looked plausible but regressed binarytrees in isolation
  • direct-arm OP_MUL shape worsened mandelbrot_long, so it was dropped

Validation

  • make test
  • bash -n harness/bench/profile-hotspots.sh
  • bash -n harness/bench/opcode-profile.sh
  • bash -n harness/bench/gc-profile.sh
  • python3 -m py_compile harness/bench/history.py harness/bench/vm-execute-attribution.py
  • PROFILE_REPEAT=2 bash harness/bench/gc-profile.sh gc_pressure
  • PROFILE_REPEAT=2 bash harness/bench/opcode-profile.sh table_hash_pressure
  • python3 harness/bench/history.py --out-dir /tmp/lua-rs-history-check

@ianm199 ianm199 merged commit 7fbc1b4 into main Jun 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant