Skip to content

Core size optimizations#5022

Merged
JoviDeCroock merged 4 commits intov10.xfrom
core-size-optimizations
Feb 16, 2026
Merged

Core size optimizations#5022
JoviDeCroock merged 4 commits intov10.xfrom
core-size-optimizations

Conversation

@JoviDeCroock
Copy link
Member

No description provided.

@github-actions
Copy link

github-actions bot commented Feb 12, 2026

📊 Tachometer Benchmark Results

Summary

duration

  • create10k: unsure 🔍 -1% - +1% (-10.42ms - +6.79ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +0% (-0.03ms - +0.03ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -0% - +2% (-0.21ms - +1.25ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -1% - +0% (-0.12ms - +0.06ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -0% - +2% (-0.12ms - +1.35ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -5% - +3% (-0.10ms - +0.06ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -0% - +1% (-0.13ms - +0.43ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -4% - +5% (-1.40ms - +1.73ms)
    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.01ms - +0.00ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -7% - +4% (-0.44ms - +0.27ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - -0% (-0.01ms - -0.00ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -7% - +1% (-0.08ms - +0.01ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -2% - +3% (-0.02ms - +0.04ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-main

Results

create10k

duration

VersionAvg timevs preact-localvs preact-main
preact-local907.41ms - 918.67ms-unsure 🔍
-1% - +1%
-10.42ms - +6.79ms
preact-main908.35ms - 921.36msunsure 🔍
-1% - +1%
-6.79ms - +10.42ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local19.19ms - 19.19ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
preact-main19.20ms - 19.20msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-
filter-list

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.55ms - 16.59ms-unsure 🔍
-0% - +0%
-0.03ms - +0.03ms
preact-main16.55ms - 16.59msunsure 🔍
-0% - +0%
-0.03ms - +0.03ms
-

usedJSHeapSize

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

duration

VersionAvg timevs preact-localvs preact-main
preact-local59.13ms - 60.30ms-unsure 🔍
-0% - +2%
-0.21ms - +1.25ms
preact-main58.76ms - 59.62msunsure 🔍
-2% - +0%
-1.25ms - +0.21ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local6.18ms - 6.68ms-unsure 🔍
-7% - +4%
-0.44ms - +0.27ms
preact-main6.26ms - 6.77msunsure 🔍
-4% - +7%
-0.27ms - +0.44ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.41ms - 16.58ms-unsure 🔍
-1% - +0%
-0.12ms - +0.06ms
preact-main16.50ms - 16.54msunsure 🔍
-0% - +1%
-0.06ms - +0.12ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.71ms - 3.72ms-unsure 🔍
-0% - -0%
-0.01ms - -0.00ms
preact-main3.72ms - 3.72msunsure 🔍
+0% - +0%
+0.00ms - +0.01ms
-
replace1k
  • Browser: chrome-headless
  • Sample size: 100
  • Built by: CI #5374
  • Commit: 1478754

duration

VersionAvg timevs preact-localvs preact-main
preact-local59.25ms - 60.39ms-unsure 🔍
-0% - +2%
-0.12ms - +1.35ms
preact-main58.74ms - 59.68msunsure 🔍
-2% - +0%
-1.35ms - +0.12ms
-

usedJSHeapSize

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

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local27.01ms - 27.82ms-unsure 🔍
-2% - +2%
-0.57ms - +0.55ms
preact-main27.04ms - 27.81msunsure 🔍
-2% - +2%
-0.55ms - +0.57ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local33.24ms - 34.58ms-unsure 🔍
-3% - +2%
-1.10ms - +0.74ms
preact-main33.46ms - 34.73msunsure 🔍
-2% - +3%
-0.74ms - +1.10ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local33.82ms - 35.11ms-unsure 🔍
-2% - +3%
-0.75ms - +1.08ms
preact-main33.64ms - 34.95msunsure 🔍
-3% - +2%
-1.08ms - +0.75ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local27.04ms - 27.46ms-unsure 🔍
-1% - +1%
-0.32ms - +0.28ms
preact-main27.06ms - 27.49msunsure 🔍
-1% - +1%
-0.28ms - +0.32ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local24.64ms - 25.91ms-unsure 🔍
-6% - +2%
-1.55ms - +0.47ms
preact-main25.03ms - 26.60msunsure 🔍
-2% - +6%
-0.47ms - +1.55ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local22.59ms - 23.07ms-unsure 🔍
-0% - +3%
-0.04ms - +0.59ms
preact-main22.35ms - 22.75msunsure 🔍
-3% - +0%
-0.59ms - +0.04ms
-
text-update
  • Browser: chrome-headless
  • Sample size: 240
  • Built by: CI #5374
  • Commit: 1478754

duration

VersionAvg timevs preact-localvs preact-main
preact-local1.91ms - 2.03ms-unsure 🔍
-5% - +3%
-0.10ms - +0.06ms
preact-main1.93ms - 2.05msunsure 🔍
-3% - +5%
-0.06ms - +0.10ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.02ms - 1.08ms-unsure 🔍
-7% - +1%
-0.08ms - +0.01ms
preact-main1.05ms - 1.12msunsure 🔍
-1% - +8%
-0.01ms - +0.08ms
-
todo

duration

VersionAvg timevs preact-localvs preact-main
preact-local32.85ms - 33.35ms-unsure 🔍
-0% - +1%
-0.13ms - +0.43ms
preact-main32.84ms - 33.06msunsure 🔍
-1% - +0%
-0.43ms - +0.13ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.28ms - 1.33ms-unsure 🔍
-2% - +3%
-0.02ms - +0.04ms
preact-main1.27ms - 1.32msunsure 🔍
-3% - +2%
-0.04ms - +0.02ms
-
update10th1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local35.10ms - 37.30ms-unsure 🔍
-4% - +5%
-1.40ms - +1.73ms
preact-main34.91ms - 37.15msunsure 🔍
-5% - +4%
-1.73ms - +1.40ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local2.97ms - 2.98ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
preact-main2.97ms - 2.98msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-

tachometer-reporter-action v2 for CI

@github-actions
Copy link

github-actions bot commented Feb 12, 2026

Size Change: -289 B (-0.37%)

Total Size: 78.7 kB

Filename Size Change
dist/preact.js 4.72 kB -40 B (-0.84%)
dist/preact.min.js 4.73 kB -48 B (-1.01%)
dist/preact.min.module.js 4.74 kB -39 B (-0.82%)
dist/preact.min.umd.js 4.75 kB -43 B (-0.9%)
dist/preact.mjs 4.73 kB -38 B (-0.8%)
dist/preact.module.js 4.73 kB -38 B (-0.8%)
dist/preact.umd.js 4.76 kB -43 B (-0.9%)
ℹ️ View Unchanged
Filename Size
compat/dist/compat.js 4.18 kB
compat/dist/compat.mjs 4.11 kB
compat/dist/compat.module.js 4.11 kB
compat/dist/compat.umd.js 4.25 kB
debug/dist/debug.js 3.85 kB
debug/dist/debug.mjs 3.85 kB
debug/dist/debug.module.js 3.85 kB
debug/dist/debug.umd.js 3.93 kB
devtools/dist/devtools.js 260 B
devtools/dist/devtools.mjs 274 B
devtools/dist/devtools.module.js 274 B
devtools/dist/devtools.umd.js 346 B
hooks/dist/hooks.js 1.53 kB
hooks/dist/hooks.mjs 1.56 kB
hooks/dist/hooks.module.js 1.56 kB
hooks/dist/hooks.umd.js 1.6 kB
jsx-runtime/dist/jsxRuntime.js 1.01 kB
jsx-runtime/dist/jsxRuntime.mjs 985 B
jsx-runtime/dist/jsxRuntime.module.js 985 B
jsx-runtime/dist/jsxRuntime.umd.js 1.08 kB
test-utils/dist/testUtils.js 473 B
test-utils/dist/testUtils.mjs 477 B
test-utils/dist/testUtils.module.js 477 B
test-utils/dist/testUtils.umd.js 555 B

compressed-size-action

for (let i = 0; i < c._stateCallbacks.length; i++) {
c._renderCallbacks.push(c._stateCallbacks[i]);
}
c._renderCallbacks.push(...c._stateCallbacks);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems expensive

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran a couple quick tests, (the transpiled output) seems to actually be marginally faster in Chrome & only slightly slower in FF. Not sure about Safari.

Of course it doesn't stay as a spread, actually becomes .push.apply():

($ = h.__h).push.apply($, h._sb)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In all of my benchmarks it was better, the larger the array the faster it is. The size optimisation feels so worth it to me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I didn't realize it would be transpiled in our config, thanks @rschristian

Yeah I'm that case I'm totally good with this.

Copy link
Member

@developit developit Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One option maybe worth checking the size of given the transpiled output:

EMPTY_ARR.push.apply(c._renderCallbacks, c._stateCallbacks);

I suspect that may be smaller and faster than the transpiled spread if used everywhere, since it has more repetition and avoids a property read.

Copy link
Member

@developit developit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM would love to check on that global push method for size before merge tho.

@JoviDeCroock JoviDeCroock merged commit 4ac7204 into v10.x Feb 16, 2026
12 checks passed
@JoviDeCroock JoviDeCroock deleted the core-size-optimizations branch February 16, 2026 17:06
@JoviDeCroock JoviDeCroock mentioned this pull request Feb 18, 2026
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

Comments