Skip to content

Walk parent _dom pointers in a loop inside renderComponent - #5380

Merged
JoviDeCroock merged 1 commit into
mainfrom
golf/parent-dom-pointers-loop
Nov 18, 2026
Merged

JoviDeCroock merged 1 commit into
mainfrom
golf/parent-dom-pointers-loop

Conversation

@JoviDeCroock

Copy link
Copy Markdown
Member

updateParentDomPointers recursed up the component ancestors and had a single caller. renderComponent now does the same walk in a loop.

The callback passed to .some() now closes over a variable of renderComponent, so V8 allocates a context on every queued rerender: about 20 bytes more short-lived heap per update in a 10,000 forceUpdate run. I measured no time difference locally on many-updates, todo, update10th1k, filter-list, text-update and replace1k.

Saves 15 B gzip in core.

Note

Written with the help of Fable 5.2

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

📊 Tachometer Benchmark Results

Summary

⏳ Benchmarks are currently running. Results below are out of date.

duration

  • create10k: unsure 🔍 -1% - +1% (-6.53ms - +5.50ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +1% (-0.02ms - +0.20ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -2% - +2% (-0.90ms - +1.04ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - +0% (-0.04ms - +0.03ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -4% - +3% (-2.21ms - +1.94ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -5% - +8% (-0.06ms - +0.09ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -1% - +2% (-0.15ms - +0.30ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -5% - +1% (-1.56ms - +0.21ms)
    preact-local vs preact-main

usedJSHeapSize

  • create10k: unsure 🔍 -0% - -0% (-0.00ms - -0.00ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -7% - +2% (-0.39ms - +0.12ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -0% - -0% (-0.00ms - -0.00ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -1% - +0% (-0.01ms - +0.00ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -0% - -0% (-0.01ms - -0.00ms)
    preact-local vs preact-main

Results

⏳ Benchmarks are currently running. Results below are out of date.
create10k

duration

VersionAvg timevs preact-localvs preact-main
preact-local637.46ms - 645.49ms-unsure 🔍
-1% - +1%
-6.53ms - +5.50ms
preact-main637.51ms - 646.47msunsure 🔍
-1% - +1%
-5.50ms - +6.53ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local19.24ms - 19.24ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
preact-main19.24ms - 19.25msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-
filter-list

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.51ms - 16.73ms-unsure 🔍
-0% - +1%
-0.02ms - +0.20ms
preact-main16.51ms - 16.55msunsure 🔍
-1% - +0%
-0.20ms - +0.02ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.56ms - 1.57ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main1.57ms - 1.57msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
hydrate1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local57.37ms - 58.71ms-unsure 🔍
-2% - +2%
-0.90ms - +1.04ms
preact-main57.27ms - 58.67msunsure 🔍
-2% - +2%
-1.04ms - +0.90ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local5.05ms - 5.33ms-unsure 🔍
-7% - +2%
-0.39ms - +0.12ms
preact-main5.11ms - 5.54msunsure 🔍
-2% - +8%
-0.12ms - +0.39ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.56ms - 16.61ms-unsure 🔍
-0% - +0%
-0.04ms - +0.03ms
preact-main16.57ms - 16.61msunsure 🔍
-0% - +0%
-0.03ms - +0.04ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.75ms - 3.75ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main3.75ms - 3.76msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
replace1k
  • Browser: chrome-headless
  • Sample size: 110
  • Built by: CI #6232
  • Commit: d47a41b

duration

VersionAvg timevs preact-localvs preact-main
preact-local60.72ms - 63.70ms-unsure 🔍
-4% - +3%
-2.21ms - +1.94ms
preact-main60.91ms - 63.79msunsure 🔍
-3% - +4%
-1.94ms - +2.21ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.03ms - 3.03ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
preact-main3.03ms - 3.03msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local16.64ms - 17.19ms-slower ❌
1% - 5%
0.13ms - 0.88ms
preact-main16.16ms - 16.67msfaster ✔
1% - 5%
0.13ms - 0.88ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local19.94ms - 20.90ms-slower ❌
3% - 9%
0.55ms - 1.68ms
preact-main19.00ms - 19.60msfaster ✔
3% - 8%
0.55ms - 1.68ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local19.85ms - 20.48ms-unsure 🔍
-1% - +4%
-0.12ms - +0.79ms
preact-main19.50ms - 20.15msunsure 🔍
-4% - +1%
-0.79ms - +0.12ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local21.93ms - 22.72ms-unsure 🔍
-2% - +4%
-0.42ms - +0.98ms
preact-main21.46ms - 22.63msunsure 🔍
-4% - +2%
-0.98ms - +0.42ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local15.61ms - 16.19ms-slower ❌
1% - 6%
0.18ms - 0.91ms
preact-main15.13ms - 15.57msfaster ✔
1% - 6%
0.18ms - 0.91ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local18.38ms - 19.07ms-unsure 🔍
-2% - +4%
-0.30ms - +0.76ms
preact-main18.09ms - 18.90msunsure 🔍
-4% - +2%
-0.76ms - +0.30ms
-
text-update
  • Browser: chrome-headless
  • Sample size: 240
  • Built by: CI #6232
  • Commit: d47a41b

duration

VersionAvg timevs preact-localvs preact-main
preact-local1.11ms - 1.23ms-unsure 🔍
-5% - +8%
-0.06ms - +0.09ms
preact-main1.11ms - 1.20msunsure 🔍
-8% - +5%
-0.09ms - +0.06ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.00ms - 1.01ms-unsure 🔍
-1% - +0%
-0.01ms - +0.00ms
preact-main1.00ms - 1.01msunsure 🔍
-0% - +1%
-0.00ms - +0.01ms
-
todo

duration

VersionAvg timevs preact-localvs preact-main
preact-local15.95ms - 16.32ms-unsure 🔍
-1% - +2%
-0.15ms - +0.30ms
preact-main15.94ms - 16.18msunsure 🔍
-2% - +1%
-0.30ms - +0.15ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.28ms - 1.28ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main1.28ms - 1.28msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
update10th1k
  • Browser: chrome-headless
  • Sample size: 130
  • Built by: CI #6232
  • Commit: d47a41b

duration

VersionAvg timevs preact-localvs preact-main
preact-local29.56ms - 30.80ms-unsure 🔍
-5% - +1%
-1.56ms - +0.21ms
preact-main30.22ms - 31.48msunsure 🔍
-1% - +5%
-0.21ms - +1.56ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local2.98ms - 2.99ms-unsure 🔍
-0% - -0%
-0.01ms - -0.00ms
preact-main2.99ms - 3.00msunsure 🔍
+0% - +0%
+0.00ms - +0.01ms
-

tachometer-reporter-action v2 for CI

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Size Change: -16 B (-0.1%)

Total Size: 16.2 kB

📦 View Changed
Filename Size Change
dist/preact.mjs 4.94 kB -16 B (-0.32%)
ℹ️ View Unchanged
Filename Size
compat/dist/compat.mjs 3.97 kB
debug/dist/debug.mjs 4.19 kB
devtools/dist/devtools.mjs 268 B
hooks/dist/hooks.mjs 1.52 kB
jsx-runtime/dist/jsxRuntime.mjs 875 B
test-utils/dist/testUtils.mjs 472 B

compressed-size-action

@coveralls

coveralls commented Nov 18, 2026 •

Copy link
Copy Markdown

Coverage Status

No base build to compare — golf/parent-dom-pointers-loop into main

@JoviDeCroock
JoviDeCroock force-pushed the golf/parent-dom-pointers-loop branch 4 times, most recently from b262a38 to 13f57e1 Compare November 18, 2026 10:30
updateParentDomPointers recursed up the component ancestors and had a
single caller. Do the same walk in a loop where it was called.
@JoviDeCroock
JoviDeCroock force-pushed the golf/parent-dom-pointers-loop branch from 13f57e1 to d47a41b Compare November 18, 2026 10:35
@JoviDeCroock
JoviDeCroock merged commit a639c81 into main Nov 18, 2026
5 checks passed
@JoviDeCroock
JoviDeCroock deleted the golf/parent-dom-pointers-loop branch November 18, 2026 10:37
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.

3 participants