Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Skip dom check for inferring lower-cased event names #4720

Merged
merged 1 commit into from
Mar 9, 2025

Conversation

rschristian
Copy link
Member

@rschristian rschristian commented Mar 6, 2025

To my knowledge, all event types are lower cased with the possible exception of user-created events, as they can be any arbitrary name. We could simplify our check here & reduce a few bytes with the assumption that any user-created event will match the platform in naming/casing which, to me, sounds pretty reasonable? Using any other form of naming would be quite odd & something we could reasonably discourage, IMO.

Breaking change though as onMyClickEvent will now listen for myclickevent instead of MyClickEvent.

Need to fiddle with the check yet, though I think that's the smallest & fastest form. Beats regex or charCodeAt for sure. Think this is the best option, lmk if anyone has other ideas!

Copy link

github-actions bot commented Mar 6, 2025

📊 Tachometer Benchmark Results

Summary

duration

  • create10k: unsure 🔍 -1% - +1% (-6.83ms - +7.96ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -2% - +2% (-0.28ms - +0.40ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -3% - +0% (-2.20ms - +0.28ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -1% - +1% (-0.10ms - +0.15ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -0% - +1% (-0.29ms - +0.90ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -4% - +5% (-0.09ms - +0.10ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -1% - +1% (-0.31ms - +0.27ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -4% - +3% (-1.33ms - +0.86ms)
    preact-local vs preact-main

usedJSHeapSize

  • create10k: unsure 🔍 +0% - +0% (+0.00ms - +0.00ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -1% - +1% (-0.01ms - +0.02ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -5% - +5% (-0.46ms - +0.46ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -1% - +0% (-0.03ms - +0.01ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -0% - +1% (-0.01ms - +0.02ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -1% - +2% (-0.01ms - +0.02ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -1% - +1% (-0.04ms - +0.02ms)
    preact-local vs preact-main

Results

create10k

duration

VersionAvg timevs preact-localvs preact-main
preact-local924.89ms - 935.90ms-unsure 🔍
-1% - +1%
-6.83ms - +7.96ms
preact-main924.90ms - 934.77msunsure 🔍
-1% - +1%
-7.96ms - +6.83ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local19.20ms - 19.20ms-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.51ms - 17.04ms-unsure 🔍
-2% - +2%
-0.28ms - +0.40ms
preact-main16.50ms - 16.92msunsure 🔍
-2% - +2%
-0.40ms - +0.28ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.52ms - 1.54ms-unsure 🔍
-1% - +1%
-0.01ms - +0.02ms
preact-main1.52ms - 1.54msunsure 🔍
-1% - +1%
-0.02ms - +0.01ms
-
hydrate1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local76.69ms - 78.28ms-unsure 🔍
-3% - +0%
-2.20ms - +0.28ms
preact-main77.50ms - 79.39msunsure 🔍
-0% - +3%
-0.28ms - +2.20ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local9.44ms - 10.04ms-unsure 🔍
-5% - +5%
-0.46ms - +0.46ms
preact-main9.39ms - 10.09msunsure 🔍
-5% - +5%
-0.46ms - +0.46ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.47ms - 16.71ms-unsure 🔍
-1% - +1%
-0.10ms - +0.15ms
preact-main16.54ms - 16.60msunsure 🔍
-1% - +1%
-0.15ms - +0.10ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.76ms - 3.79ms-unsure 🔍
-1% - +0%
-0.03ms - +0.01ms
preact-main3.76ms - 3.80msunsure 🔍
-0% - +1%
-0.01ms - +0.03ms
-
replace1k
  • Browser: chrome-headless
  • Sample size: 100
  • Built by: CI #4590
  • Commit: e9195dd

duration

VersionAvg timevs preact-localvs preact-main
preact-local65.09ms - 66.12ms-unsure 🔍
-0% - +1%
-0.29ms - +0.90ms
preact-main65.00ms - 65.60msunsure 🔍
-1% - +0%
-0.90ms - +0.29ms
-

usedJSHeapSize

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

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local29.52ms - 30.13ms-unsure 🔍
-2% - +1%
-0.52ms - +0.43ms
preact-main29.51ms - 30.23msunsure 🔍
-1% - +2%
-0.43ms - +0.52ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local33.79ms - 34.90ms-unsure 🔍
-2% - +2%
-0.81ms - +0.84ms
preact-main33.72ms - 34.95msunsure 🔍
-2% - +2%
-0.84ms - +0.81ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local25.18ms - 25.65ms-unsure 🔍
-1% - +1%
-0.27ms - +0.34ms
preact-main25.19ms - 25.57msunsure 🔍
-1% - +1%
-0.34ms - +0.27ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local25.56ms - 26.64ms-unsure 🔍
-1% - +4%
-0.37ms - +1.08ms
preact-main25.26ms - 26.23msunsure 🔍
-4% - +1%
-1.08ms - +0.37ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local24.64ms - 25.66ms-unsure 🔍
-5% - +1%
-1.23ms - +0.17ms
preact-main25.20ms - 26.16msunsure 🔍
-1% - +5%
-0.17ms - +1.23ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local19.74ms - 20.27ms-unsure 🔍
-1% - +2%
-0.29ms - +0.34ms
preact-main19.80ms - 20.16msunsure 🔍
-2% - +1%
-0.34ms - +0.29ms
-
text-update

duration

VersionAvg timevs preact-localvs preact-main
preact-local2.09ms - 2.22ms-unsure 🔍
-4% - +5%
-0.09ms - +0.10ms
preact-main2.07ms - 2.22msunsure 🔍
-5% - +4%
-0.10ms - +0.09ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.12ms - 1.12ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main1.12ms - 1.12msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
todo

duration

VersionAvg timevs preact-localvs preact-main
preact-local33.00ms - 33.47ms-unsure 🔍
-1% - +1%
-0.31ms - +0.27ms
preact-main33.08ms - 33.43msunsure 🔍
-1% - +1%
-0.27ms - +0.31ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.23ms - 1.25ms-unsure 🔍
-1% - +2%
-0.01ms - +0.02ms
preact-main1.22ms - 1.24msunsure 🔍
-2% - +1%
-0.02ms - +0.01ms
-
update10th1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local30.95ms - 32.37ms-unsure 🔍
-4% - +3%
-1.33ms - +0.86ms
preact-main31.06ms - 32.73msunsure 🔍
-3% - +4%
-0.86ms - +1.33ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local2.94ms - 2.98ms-unsure 🔍
-1% - +1%
-0.04ms - +0.02ms
preact-main2.95ms - 3.00msunsure 🔍
-1% - +1%
-0.02ms - +0.04ms
-

tachometer-reporter-action v2 for CI

Copy link

github-actions bot commented Mar 6, 2025

Size Change: -44 B (-0.09%)

Total Size: 46.4 kB

Filename Size Change
dist/preact.js 4.62 kB -15 B (-0.32%)
dist/preact.mjs 4.63 kB -14 B (-0.3%)
dist/preact.umd.js 4.68 kB -15 B (-0.32%)
ℹ️ View Unchanged
Filename Size
compat/dist/compat.js 3.69 kB
compat/dist/compat.mjs 3.61 kB
compat/dist/compat.umd.js 3.75 kB
debug/dist/debug.js 3.85 kB
debug/dist/debug.mjs 3.85 kB
debug/dist/debug.umd.js 3.94 kB
devtools/dist/devtools.js 260 B
devtools/dist/devtools.mjs 271 B
devtools/dist/devtools.umd.js 346 B
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 861 B
jsx-runtime/dist/jsxRuntime.mjs 830 B
jsx-runtime/dist/jsxRuntime.umd.js 934 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

@rschristian rschristian marked this pull request as ready for review March 6, 2025 21:32
Copy link
Member

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

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

This is clever!

@rschristian rschristian merged commit 151b2ef into v11-2 Mar 9, 2025
15 checks passed
@rschristian rschristian deleted the refactor/event-inference branch March 9, 2025 01:25
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