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

Use == where possible and precompute .length #4599

Merged
merged 2 commits into from
Dec 8, 2024
Merged

Conversation

JoviDeCroock
Copy link
Member

@JoviDeCroock JoviDeCroock commented Dec 7, 2024

Just did a pass of where we can use == instead of === which should save some bytes. I've also hoisted the .length accessor from children which should be cheaper perf wise.

Copy link

github-actions bot commented Dec 7, 2024

📊 Tachometer Benchmark Results

Summary

duration

  • create10k: unsure 🔍 -0% - +1% (-0.75ms - +6.34ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -1% - +4% (-0.14ms - +0.71ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -2% - +1% (-1.21ms - +0.68ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -1% - +1% (-0.11ms - +0.15ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -0% - +1% (-0.27ms - +0.77ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -4% - +6% (-0.08ms - +0.12ms)
    preact-local vs preact-main
  • todo: slower ❌ 1% - 2% (0.36ms - 0.79ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -4% - +5% (-1.19ms - +1.61ms)
    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.02ms - +0.01ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -2% - +5% (-0.26ms - +0.52ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - +0% (-0.01ms - +0.02ms)
    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% - +0% (-0.01ms - +0.00ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -1% - +1% (-0.02ms - +0.02ms)
    preact-local vs preact-main

Results

create10k

duration

VersionAvg timevs preact-localvs preact-main
preact-local931.72ms - 935.85ms-unsure 🔍
-0% - +1%
-0.75ms - +6.34ms
preact-main928.11ms - 933.87msunsure 🔍
-1% - +0%
-6.34ms - +0.75ms
-

usedJSHeapSize

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

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.52ms - 17.35ms-unsure 🔍
-1% - +4%
-0.14ms - +0.71ms
preact-main16.59ms - 16.71msunsure 🔍
-4% - +1%
-0.71ms - +0.14ms
-

usedJSHeapSize

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

duration

VersionAvg timevs preact-localvs preact-main
preact-local65.83ms - 67.05ms-unsure 🔍
-2% - +1%
-1.21ms - +0.68ms
preact-main65.98ms - 67.43msunsure 🔍
-1% - +2%
-0.68ms - +1.21ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local10.35ms - 10.90ms-unsure 🔍
-2% - +5%
-0.26ms - +0.52ms
preact-main10.22ms - 10.77msunsure 🔍
-5% - +2%
-0.52ms - +0.26ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.55ms - 16.77ms-unsure 🔍
-1% - +1%
-0.11ms - +0.15ms
preact-main16.56ms - 16.71msunsure 🔍
-1% - +1%
-0.15ms - +0.11ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.75ms - 3.78ms-unsure 🔍
-0% - +0%
-0.01ms - +0.02ms
preact-main3.75ms - 3.77msunsure 🔍
-0% - +0%
-0.02ms - +0.01ms
-
replace1k
  • Browser: chrome-headless
  • Sample size: 100
  • Built by: CI #4179
  • Commit: da20015

duration

VersionAvg timevs preact-localvs preact-main
preact-local66.99ms - 67.78ms-unsure 🔍
-0% - +1%
-0.27ms - +0.77ms
preact-main66.80ms - 67.47msunsure 🔍
-1% - +0%
-0.77ms - +0.27ms
-

usedJSHeapSize

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

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local30.34ms - 30.90ms-unsure 🔍
-1% - +2%
-0.29ms - +0.51ms
preact-main30.22ms - 30.79msunsure 🔍
-2% - +1%
-0.51ms - +0.29ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local34.19ms - 35.35ms-unsure 🔍
-4% - +1%
-1.42ms - +0.46ms
preact-main34.51ms - 35.99msunsure 🔍
-1% - +4%
-0.46ms - +1.42ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local25.77ms - 26.11ms-unsure 🔍
-2% - +1%
-0.45ms - +0.19ms
preact-main25.80ms - 26.34msunsure 🔍
-1% - +2%
-0.19ms - +0.45ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local25.93ms - 27.01ms-unsure 🔍
-6% - +0%
-1.57ms - +0.08ms
preact-main26.59ms - 27.84msunsure 🔍
-0% - +6%
-0.08ms - +1.57ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local24.33ms - 25.56ms-unsure 🔍
-5% - +2%
-1.24ms - +0.46ms
preact-main24.76ms - 25.92msunsure 🔍
-2% - +5%
-0.46ms - +1.24ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local22.13ms - 22.53ms-unsure 🔍
-0% - +2%
-0.10ms - +0.45ms
preact-main21.96ms - 22.35msunsure 🔍
-2% - +0%
-0.45ms - +0.10ms
-
text-update
  • Browser: chrome-headless
  • Sample size: 220
  • Built by: CI #4179
  • Commit: da20015

duration

VersionAvg timevs preact-localvs preact-main
preact-local2.12ms - 2.26ms-unsure 🔍
-4% - +6%
-0.08ms - +0.12ms
preact-main2.10ms - 2.23msunsure 🔍
-6% - +3%
-0.12ms - +0.08ms
-

usedJSHeapSize

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

duration

VersionAvg timevs preact-localvs preact-main
preact-local33.94ms - 34.22ms-slower ❌
1% - 2%
0.36ms - 0.79ms
preact-main33.35ms - 33.67msfaster ✔
1% - 2%
0.36ms - 0.79ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.23ms - 1.23ms-unsure 🔍
-1% - +0%
-0.01ms - +0.00ms
preact-main1.22ms - 1.24msunsure 🔍
-0% - +1%
-0.00ms - +0.01ms
-
update10th1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local32.17ms - 34.03ms-unsure 🔍
-4% - +5%
-1.19ms - +1.61ms
preact-main31.84ms - 33.94msunsure 🔍
-5% - +4%
-1.61ms - +1.19ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local2.91ms - 2.94ms-unsure 🔍
-1% - +1%
-0.02ms - +0.02ms
preact-main2.91ms - 2.94msunsure 🔍
-1% - +1%
-0.02ms - +0.02ms
-

tachometer-reporter-action v2 for CI

Copy link

github-actions bot commented Dec 7, 2024

Size Change: -30 B (-0.05%)

Total Size: 62.3 kB

Filename Size Change
dist/preact.js 4.71 kB -4 B (-0.08%)
dist/preact.min.js 4.73 kB -5 B (-0.11%)
dist/preact.min.module.js 4.73 kB -2 B (-0.04%)
dist/preact.min.umd.js 4.75 kB -5 B (-0.11%)
dist/preact.module.js 4.73 kB -7 B (-0.15%)
dist/preact.umd.js 4.77 kB -7 B (-0.15%)
ℹ️ View Unchanged
Filename Size
compat/dist/compat.js 4.13 kB
compat/dist/compat.module.js 4.06 kB
compat/dist/compat.umd.js 4.2 kB
debug/dist/debug.js 3.82 kB
debug/dist/debug.module.js 3.83 kB
debug/dist/debug.umd.js 3.9 kB
devtools/dist/devtools.js 260 B
devtools/dist/devtools.module.js 274 B
devtools/dist/devtools.umd.js 346 B
hooks/dist/hooks.js 1.52 kB
hooks/dist/hooks.module.js 1.56 kB
hooks/dist/hooks.umd.js 1.6 kB
jsx-runtime/dist/jsxRuntime.js 973 B
jsx-runtime/dist/jsxRuntime.module.js 947 B
jsx-runtime/dist/jsxRuntime.umd.js 1.05 kB
test-utils/dist/testUtils.js 451 B
test-utils/dist/testUtils.module.js 456 B
test-utils/dist/testUtils.umd.js 536 B

compressed-size-action

@coveralls
Copy link

coveralls commented Dec 7, 2024

Coverage Status

coverage: 99.617%. remained the same
when pulling da20015 on optimize-bundles
into dee5673 on main.

Copy link
Member

@rschristian rschristian left a comment

Choose a reason for hiding this comment

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

Good finds

@JoviDeCroock JoviDeCroock merged commit 803b106 into main Dec 8, 2024
13 checks passed
@JoviDeCroock JoviDeCroock deleted the optimize-bundles branch December 8, 2024 09:35
@JoviDeCroock JoviDeCroock mentioned this pull request Dec 12, 2024
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