Skip to content

Reduce core bundle size in v11#5167

Open
JoviDeCroock wants to merge 4 commits into
mainfrom
JoviDeCroock/reduce-core-bundle-size
Open

Reduce core bundle size in v11#5167
JoviDeCroock wants to merge 4 commits into
mainfrom
JoviDeCroock/reduce-core-bundle-size

Conversation

@JoviDeCroock

Copy link
Copy Markdown
Member
  • Co-locating cloneElement with createElement benefits gzip with 8 bytes
  • We can check handled for error-checking once and later
  • We don't have to check oldVNode in children because it's always true (default empty_obj)
  • Reduce the mathml regex

Simplify core control flow and reuse existing constants to reduce the production bundle from 4,857 to 4,814 bytes gzip while preserving behavior.
Keep createElement and cloneElement normalization together and reuse their argument counts. This reduces core from 4,814 to 4,804 bytes gzip without adding runtime work.
Restore the existing isValidElement declaration and remove the obsolete cloneElement re-export module. This leaves core at 4,806 bytes gzip while narrowing source churn.
@github-actions

github-actions Bot commented Jul 18, 2026

Copy link
Copy Markdown

📊 Tachometer Benchmark Results

Summary

duration

  • create10k: slower ❌ 0% - 2% (3.81ms - 13.71ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +1% (-0.02ms - +0.13ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -0% - +2% (-0.18ms - +0.89ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -1% - +0% (-0.15ms - +0.06ms)
    preact-local vs preact-main
  • replace1k: slower ❌ 2% - 6% (1.08ms - 3.09ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -5% - +3% (-0.08ms - +0.04ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -2% - +0% (-0.74ms - +0.15ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -1% - +5% (-0.38ms - +1.57ms)
    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 🔍 -2% - +1% (-0.11ms - +0.03ms)
    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 🔍 -2% - +3% (-0.03ms - +0.03ms)
    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.01ms)
    preact-local vs preact-main

Results

create10k

duration

VersionAvg timevs preact-localvs preact-main
preact-local826.51ms - 834.82ms-slower ❌
0% - 2%
3.81ms - 13.71ms
preact-main819.22ms - 824.60msfaster ✔
0% - 2%
3.81ms - 13.71ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local19.08ms - 19.08ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
preact-main19.08ms - 19.08msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-
filter-list

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.55ms - 16.69ms-unsure 🔍
-0% - +1%
-0.02ms - +0.13ms
preact-main16.54ms - 16.59msunsure 🔍
-1% - +0%
-0.13ms - +0.02ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.55ms - 1.55ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
preact-main1.55ms - 1.55msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-
hydrate1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local54.99ms - 55.62ms-unsure 🔍
-0% - +2%
-0.18ms - +0.89ms
preact-main54.51ms - 55.38msunsure 🔍
-2% - +0%
-0.89ms - +0.18ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local5.00ms - 5.00ms-unsure 🔍
-2% - +1%
-0.11ms - +0.03ms
preact-main4.97ms - 5.11msunsure 🔍
-1% - +2%
-0.03ms - +0.11ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.42ms - 16.56ms-unsure 🔍
-1% - +0%
-0.15ms - +0.06ms
preact-main16.46ms - 16.61msunsure 🔍
-0% - +1%
-0.06ms - +0.15ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.74ms - 3.74ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
preact-main3.74ms - 3.75msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-
replace1k
  • Browser: chrome-headless
  • Sample size: 100
  • Built by: CI #5697
  • Commit: 529bc4b

duration

VersionAvg timevs preact-localvs preact-main
preact-local55.93ms - 57.63ms-slower ❌
2% - 6%
1.08ms - 3.09ms
preact-main54.16ms - 55.23msfaster ✔
2% - 5%
1.08ms - 3.09ms
-

usedJSHeapSize

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

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local29.78ms - 30.47ms-slower ❌
2% - 6%
0.52ms - 1.68ms
preact-main28.56ms - 29.50msfaster ✔
2% - 6%
0.52ms - 1.68ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local34.28ms - 35.68ms-unsure 🔍
-1% - +5%
-0.38ms - +1.60ms
preact-main33.67ms - 35.07msunsure 🔍
-5% - +1%
-1.60ms - +0.38ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local30.78ms - 32.12ms-slower ❌
2% - 8%
0.71ms - 2.50ms
preact-main29.25ms - 30.45msfaster ✔
2% - 8%
0.71ms - 2.50ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local26.62ms - 27.39ms-slower ❌
2% - 6%
0.65ms - 1.49ms
preact-main25.76ms - 26.10msfaster ✔
2% - 5%
0.65ms - 1.49ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local23.87ms - 25.33ms-unsure 🔍
-2% - +6%
-0.56ms - +1.51ms
preact-main23.39ms - 24.86msunsure 🔍
-6% - +2%
-1.51ms - +0.56ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local21.49ms - 22.36ms-slower ❌
4% - 9%
0.89ms - 1.82ms
preact-main20.40ms - 20.73msfaster ✔
4% - 8%
0.89ms - 1.82ms
-
text-update
  • Browser: chrome-headless
  • Sample size: 240
  • Built by: CI #5697
  • Commit: 529bc4b

duration

VersionAvg timevs preact-localvs preact-main
preact-local1.57ms - 1.65ms-unsure 🔍
-5% - +3%
-0.08ms - +0.04ms
preact-main1.58ms - 1.67msunsure 🔍
-3% - +5%
-0.04ms - +0.08ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.02ms - 1.05ms-unsure 🔍
-2% - +3%
-0.03ms - +0.03ms
preact-main1.02ms - 1.05msunsure 🔍
-3% - +2%
-0.03ms - +0.03ms
-
todo

duration

VersionAvg timevs preact-localvs preact-main
preact-local32.66ms - 33.04ms-unsure 🔍
-2% - +0%
-0.74ms - +0.15ms
preact-main32.74ms - 33.55msunsure 🔍
-0% - +2%
-0.15ms - +0.74ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.26ms - 1.26ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
preact-main1.27ms - 1.27msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-
update10th1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local32.45ms - 33.78ms-unsure 🔍
-1% - +5%
-0.38ms - +1.57ms
preact-main31.81ms - 33.22msunsure 🔍
-5% - +1%
-1.57ms - +0.38ms
-

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
Copy Markdown

Size Change: -50 B (-0.32%)

Total Size: 15.8 kB

📦 View Changed
Filename Size Change
dist/preact.mjs 4.84 kB -50 B (-1.02%)
ℹ️ View Unchanged
Filename Size
compat/dist/compat.mjs 3.87 kB
debug/dist/debug.mjs 3.89 kB
devtools/dist/devtools.mjs 274 B
hooks/dist/hooks.mjs 1.55 kB
jsx-runtime/dist/jsxRuntime.mjs 861 B
test-utils/dist/testUtils.mjs 473 B

compressed-size-action

@coveralls

coveralls commented Jul 18, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 98.534%. remained the same — JoviDeCroock/reduce-core-bundle-size into main

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.

2 participants