Skip to content

Experiment: Lazy arena allocation on JS#1334

Draft
jiribenes wants to merge 2 commits intomainfrom
experiment/js/lazy-arena-alloc
Draft

Experiment: Lazy arena allocation on JS#1334
jiribenes wants to merge 2 commits intomainfrom
experiment/js/lazy-arena-alloc

Conversation

@jiribenes
Copy link
Copy Markdown
Contributor

On LLVM, we allocate the arena for mutable variables only on demand. Why not do the same in JS?


The implementation is a bit ugly, I think this could be improved if we merge #1332 first.
I left in a lot of comments so that I understand what the heck is going on, these should be tidied up a bit before merging.

Speedup in total is some 3-4% (geomean), everything that sometimes allocates got much faster.
Below are the significant changes (ran with hyperfine, warmup = 5, N ≥ 10, inputs from the config_js.txt file), everything else is negligible as per the Welch t-test (using mean, stddev & number of runs; the tests where hyperfine complained about outliers are deemed as not significant):

Benchmark main after #1330 this PR Δ
mandelbrot 177.1 ms 129.3 ms −27.0%
parsing_dollars 1234.4 ms 1129.0 ms −8.5%
triples 374.9 ms 357.2 ms −4.7%
iterator 115.4 ms 112.3 ms −2.7%
sieve 150.2 ms 146.6 ms −2.4%
word_count_ascii 576.8 ms 563.1 ms −2.4%
erase_unused 242.0 ms 237.3 ms −1.9%
word_count_utf8 371.4 ms 364.3 ms −1.9%
nqueens 199.0 ms 196.8 ms −1.1%
factorial_accumulator 2354.2 ms 2341.3 ms −0.5%
nbody 497.0 ms 494.4 ms −0.5%
storage 689.6 ms 695.5 ms +0.9%

@jiribenes jiribenes added area:js experiment Experimental branch, do not merge! labels Mar 21, 2026
@jiribenes jiribenes added the help wanted Extra attention is needed label Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:js experiment Experimental branch, do not merge! help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant