Skip to content

Conversation

@JoviDeCroock
Copy link
Member

@JoviDeCroock JoviDeCroock commented Aug 8, 2025

  • Defer toLowerCase() to only when needed (event props and translate), avoiding per-prop lowercasing on the hot path.
  • Remove ON_ANI regex and rely on core preact event normalization.
  • Preserve React-compat remaps:
    • onDoubleClick -> ondblclick
    • onChange -> oninput for input/textarea (except file/checkbox/radio)
    • onFocus -> onfocusin, onBlur -> onfocusout
    • Handle oninput duplication via oninputCapture

Reduces unnecessary string ops and regex checks.
Small bundle size reduction and improved render perf in compat.

@github-actions
Copy link

github-actions bot commented Aug 8, 2025

📊 Tachometer Benchmark Results

Summary

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

duration

  • create10k: unsure 🔍 -1% - +1% (-7.41ms - +6.00ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +0% (-0.07ms - +0.05ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -1% - +2% (-0.82ms - +1.60ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - +0% (-0.01ms - +0.05ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -2% - +1% (-0.92ms - +0.65ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -1% - +5% (-0.03ms - +0.09ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -0% - +1% (-0.15ms - +0.29ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -4% - +3% (-1.34ms - +0.96ms)
    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: faster ✔ 2% - 12% (0.11ms - 0.78ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -0% - +1% (-0.01ms - +0.03ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -2% - +0% (-0.02ms - +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.01ms)
    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-local969.24ms - 980.41ms-unsure 🔍
-1% - +1%
-7.41ms - +6.00ms
preact-main971.82ms - 979.25msunsure 🔍
-1% - +1%
-6.00ms - +7.41ms
-

usedJSHeapSize

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

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.49ms - 16.54ms-unsure 🔍
-0% - +0%
-0.07ms - +0.05ms
preact-main16.48ms - 16.58msunsure 🔍
-0% - +0%
-0.05ms - +0.07ms
-

usedJSHeapSize

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

duration

VersionAvg timevs preact-localvs preact-main
preact-local69.09ms - 70.82ms-unsure 🔍
-1% - +2%
-0.82ms - +1.60ms
preact-main68.72ms - 70.41msunsure 🔍
-2% - +1%
-1.60ms - +0.82ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local5.58ms - 6.01ms-faster ✔
2% - 12%
0.11ms - 0.78ms
preact-main5.98ms - 6.49msslower ❌
2% - 14%
0.11ms - 0.78ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.55ms - 16.59ms-unsure 🔍
-0% - +0%
-0.01ms - +0.05ms
preact-main16.53ms - 16.57msunsure 🔍
-0% - +0%
-0.05ms - +0.01ms
-

usedJSHeapSize

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

duration

VersionAvg timevs preact-localvs preact-main
preact-local60.34ms - 61.43ms-unsure 🔍
-2% - +1%
-0.92ms - +0.65ms
preact-main60.46ms - 61.58msunsure 🔍
-1% - +2%
-0.65ms - +0.92ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.09ms - 3.12ms-unsure 🔍
-0% - +1%
-0.01ms - +0.03ms
preact-main3.09ms - 3.12msunsure 🔍
-1% - +0%
-0.03ms - +0.01ms
-

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local25.11ms - 25.82ms-unsure 🔍
-3% - +1%
-0.68ms - +0.38ms
preact-main25.23ms - 26.01msunsure 🔍
-1% - +3%
-0.38ms - +0.68ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local32.66ms - 33.73ms-slower ❌
0% - 4%
0.01ms - 1.43ms
preact-main32.01ms - 32.94msfaster ✔
0% - 4%
0.01ms - 1.43ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local29.90ms - 30.69ms-unsure 🔍
-1% - +3%
-0.32ms - +0.83ms
preact-main29.62ms - 30.46msunsure 🔍
-3% - +1%
-0.83ms - +0.32ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local26.18ms - 27.08ms-unsure 🔍
-3% - +2%
-0.68ms - +0.50ms
preact-main26.34ms - 27.09msunsure 🔍
-2% - +3%
-0.50ms - +0.68ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local22.57ms - 23.73ms-unsure 🔍
-4% - +3%
-1.02ms - +0.67ms
preact-main22.71ms - 23.95msunsure 🔍
-3% - +4%
-0.67ms - +1.02ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local20.63ms - 21.43ms-unsure 🔍
-3% - +2%
-0.67ms - +0.49ms
preact-main20.69ms - 21.55msunsure 🔍
-2% - +3%
-0.49ms - +0.67ms
-
text-update
  • Browser: chrome-headless
  • Sample size: 220
  • Built by: CI #5024
  • Commit: 8bbc8d9

duration

VersionAvg timevs preact-localvs preact-main
preact-local1.85ms - 1.94ms-unsure 🔍
-1% - +5%
-0.03ms - +0.09ms
preact-main1.83ms - 1.90msunsure 🔍
-5% - +1%
-0.09ms - +0.03ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local0.97ms - 0.98ms-unsure 🔍
-2% - +0%
-0.02ms - +0.00ms
preact-main0.98ms - 1.00msunsure 🔍
-0% - +2%
-0.00ms - +0.02ms
-
todo

duration

VersionAvg timevs preact-localvs preact-main
preact-local30.64ms - 30.99ms-unsure 🔍
-0% - +1%
-0.15ms - +0.29ms
preact-main30.62ms - 30.88msunsure 🔍
-1% - +0%
-0.29ms - +0.15ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.25ms - 1.25ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main1.24ms - 1.25msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
update10th1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local31.39ms - 32.80ms-unsure 🔍
-4% - +3%
-1.34ms - +0.96ms
preact-main31.38ms - 33.19msunsure 🔍
-3% - +4%
-0.96ms - +1.34ms
-

usedJSHeapSize

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

tachometer-reporter-action v2 for CI

@github-actions
Copy link

github-actions bot commented Aug 8, 2025

Size Change: -88 B (-0.18%)

Total Size: 47.5 kB

Filename Size Change
compat/dist/compat.js 3.9 kB -29 B (-0.74%)
compat/dist/compat.mjs 3.82 kB -26 B (-0.68%)
compat/dist/compat.umd.js 3.95 kB -33 B (-0.83%)
ℹ️ View Unchanged
Filename Size
debug/dist/debug.js 3.9 kB
debug/dist/debug.mjs 3.9 kB
debug/dist/debug.umd.js 3.98 kB
devtools/dist/devtools.js 260 B
devtools/dist/devtools.mjs 271 B
devtools/dist/devtools.umd.js 346 B
dist/preact.js 4.7 kB
dist/preact.mjs 4.72 kB
dist/preact.umd.js 4.77 kB
hooks/dist/hooks.js 1.55 kB
hooks/dist/hooks.mjs 1.58 kB
hooks/dist/hooks.umd.js 1.62 kB
jsx-runtime/dist/jsxRuntime.js 892 B
jsx-runtime/dist/jsxRuntime.mjs 861 B
jsx-runtime/dist/jsxRuntime.umd.js 966 B
test-utils/dist/testUtils.js 473 B
test-utils/dist/testUtils.mjs 473 B
test-utils/dist/testUtils.umd.js 555 B

compressed-size-action

@coveralls
Copy link

coveralls commented Aug 8, 2025

Coverage Status

coverage: 99.536% (-0.003%) from 99.539%
when pulling 23fd1d0 on compat-render-opt
into b0d9195 on main.

Comment on lines 166 to 167
} else if (i === 'translate' && value === 'no') {
// Lowercase only for this specific, rare prop
value = false;
Copy link
Member

Choose a reason for hiding this comment

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

This comment doesn't make sense to me, might be a leftover from an earlier iteration? Or am I being daft (also very possible)?

Copy link
Member

Choose a reason for hiding this comment

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

And good spot BTW! Dropping the regex is great

Copy link
Member Author

Choose a reason for hiding this comment

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

Whups, you're right, I first had toLowerCase for translate and then realised we don't need that 😅

@JoviDeCroock JoviDeCroock merged commit c242faf into main Aug 10, 2025
12 checks passed
@JoviDeCroock JoviDeCroock deleted the compat-render-opt branch August 10, 2025 05:13
@JoviDeCroock JoviDeCroock mentioned this pull request Aug 19, 2025
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.

4 participants