Skip to content

Skip Object.keys allocation in FunctionHelperManager.getValue - #21601

Open
NullVoxPopuli wants to merge 1 commit into
emberjs:mainfrom
NullVoxPopuli:nvp/perf/function-helper-named-args
Open

Skip Object.keys allocation in FunctionHelperManager.getValue#21601
NullVoxPopuli wants to merge 1 commit into
emberjs:mainfrom
NullVoxPopuli:nvp/perf/function-helper-named-args

Conversation

@NullVoxPopuli

@NullVoxPopuli NullVoxPopuli commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Checking for named arguments with for...in avoids allocating a keys array on every plain-function helper invocation. Helpers without named args are the common case.

Split out of nvp/simplify-some-vm-hot-paths.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@NullVoxPopuli NullVoxPopuli changed the title [PERF] Skip Object.keys allocation in FunctionHelperManager.getValue Skip Object.keys allocation in FunctionHelperManager.getValue Sep 9, 2026
@NullVoxPopuli

Copy link
Copy Markdown
Contributor Author

Benchmark: main (bdb2580) vs nvp/perf/function-helper-named-args (11da660)

Ran via pnpm bench (the krausest js-framework-benchmark scenario in smoke-tests/benchmark-app, tracerbench, 20 samples each, 8x CPU throttle). Negative delta means the PR is faster. Only rows tracerbench marks significant (p < 0.05) are meaningful.

Phase main median PR median Δ (estimator) 95% CI Significant
Total duration 9,164ms 9,235ms 25ms (+0.3%) -235ms .. 337ms
render 141ms 141ms 0ms (-0.0%) -12ms .. 8ms
render1000Items1 350ms 349ms -1ms (-0.2%) -14ms .. 12ms
clearItems1 37ms 36ms 0ms (-0.8%) -2ms .. 1ms
render1000Items2 284ms 283ms 1ms (+0.5%) -8ms .. 14ms
clearItems2 135ms 136ms 1ms (+0.4%) -2ms .. 2ms
render10000Items1 2,669ms 2,742ms 10ms (+0.4%) -66ms .. 114ms
clearManyItems1 362ms 362ms 1ms (+0.2%) -6ms .. 6ms
render10000Items2 2,655ms 2,640ms 11ms (+0.4%) -57ms .. 118ms
clearManyItems2 258ms 254ms -3ms (-1.0%) -10ms .. 6ms
render1000Items3 238ms 240ms 1ms (+0.5%) -8ms .. 18ms
append1000Items1 368ms 343ms -8ms (-2.1%) -46ms .. 18ms
append1000Items2 319ms 327ms 2ms (+0.7%) -22ms .. 37ms
updateEvery10thItem1 281ms 275ms -3ms (-1.2%) -16ms .. 15ms
updateEvery10thItem2 298ms 291ms -3ms (-1.0%) -21ms .. 14ms
selectFirstRow1 73ms 73ms 2ms (+3.1%) -4ms .. 11ms
selectSecondRow1 59ms 54ms -1ms (-1.3%) -7ms .. 2ms
removeFirstRow1 185ms 191ms 8ms (+4.4%) -2ms .. 17ms
removeSecondRow1 177ms 178ms 0ms (+0.0%) -9ms .. 15ms
swapRows1 117ms 119ms 1ms (+1.1%) -4ms .. 12ms
swapRows2 120ms 117ms 0ms (+0.3%) -9ms .. 7ms
clearItems4 103ms 104ms 0ms (-0.1%) -2ms .. 3ms
paint 10ms 10ms 2ms (+15.2%) -2ms .. 4ms

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