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

Move some frequently used things to constants #4579

Merged
merged 2 commits into from
Nov 29, 2024

Conversation

JoviDeCroock
Copy link
Member

This checks the performance of moving some longer strings to constants to avoid re-allocating in the critical path. Some of these could also optimise easier as the function gets shorter

Copy link

github-actions bot commented Nov 29, 2024

📊 Tachometer Benchmark Results

Summary

duration

  • create10k: unsure 🔍 -0% - +1% (-0.11ms - +13.37ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -1% - +1% (-0.15ms - +0.14ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -4% - +1% (-2.85ms - +0.76ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -3% - +2% (-0.43ms - +0.34ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -1% - +2% (-0.69ms - +1.19ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -2% - +6% (-0.04ms - +0.13ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -1% - +1% (-0.38ms - +0.47ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -2% - +4% (-0.57ms - +1.20ms)
    preact-local vs preact-main

usedJSHeapSize

  • create10k: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +1% (-0.01ms - +0.02ms)
    preact-local vs preact-main
  • hydrate1k: faster ✔ 9% - 17% (1.15ms - 2.37ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -1% - +0% (-0.03ms - +0.00ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -1% - +1% (-0.03ms - +0.02ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -2% - +0% (-0.02ms - +0.00ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -0% - +1% (-0.01ms - +0.02ms)
    preact-local vs preact-main

Results

create10k

duration

VersionAvg timevs preact-localvs preact-main
preact-local933.41ms - 946.17ms-unsure 🔍
-0% - +1%
-0.11ms - +13.37ms
preact-main930.98ms - 935.34msunsure 🔍
-1% - +0%
-13.37ms - +0.11ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local24.84ms - 24.84ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main24.84ms - 24.84msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
filter-list

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.46ms - 16.74ms-unsure 🔍
-1% - +1%
-0.15ms - +0.14ms
preact-main16.57ms - 16.64msunsure 🔍
-1% - +1%
-0.14ms - +0.15ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.65ms - 1.67ms-unsure 🔍
-0% - +1%
-0.01ms - +0.02ms
preact-main1.64ms - 1.66msunsure 🔍
-1% - +0%
-0.02ms - +0.01ms
-
hydrate1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local75.70ms - 78.60ms-unsure 🔍
-4% - +1%
-2.85ms - +0.76ms
preact-main77.11ms - 79.27msunsure 🔍
-1% - +4%
-0.76ms - +2.85ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local11.29ms - 12.13ms-faster ✔
9% - 17%
1.15ms - 2.37ms
preact-main13.03ms - 13.91msslower ❌
9% - 21%
1.15ms - 2.37ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local15.32ms - 15.81ms-unsure 🔍
-3% - +2%
-0.43ms - +0.34ms
preact-main15.31ms - 15.91msunsure 🔍
-2% - +3%
-0.34ms - +0.43ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local4.49ms - 4.51ms-unsure 🔍
-1% - +0%
-0.03ms - +0.00ms
preact-main4.50ms - 4.52msunsure 🔍
-0% - +1%
-0.00ms - +0.03ms
-
replace1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local67.73ms - 69.05ms-unsure 🔍
-1% - +2%
-0.69ms - +1.19ms
preact-main67.47ms - 68.81msunsure 🔍
-2% - +1%
-1.19ms - +0.69ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.56ms - 3.60ms-unsure 🔍
-1% - +1%
-0.03ms - +0.02ms
preact-main3.57ms - 3.60msunsure 🔍
-1% - +1%
-0.02ms - +0.03ms
-

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local30.96ms - 31.80ms-unsure 🔍
-3% - +2%
-0.86ms - +0.62ms
preact-main30.89ms - 32.11msunsure 🔍
-2% - +3%
-0.62ms - +0.86ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local36.66ms - 38.27ms-unsure 🔍
-3% - +3%
-1.07ms - +1.13ms
preact-main36.69ms - 38.19msunsure 🔍
-3% - +3%
-1.13ms - +1.07ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local30.20ms - 31.14ms-unsure 🔍
-4% - +1%
-1.20ms - +0.23ms
preact-main30.62ms - 31.70msunsure 🔍
-1% - +4%
-0.23ms - +1.20ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local23.23ms - 23.71ms-unsure 🔍
-2% - +1%
-0.49ms - +0.24ms
preact-main23.32ms - 23.87msunsure 🔍
-1% - +2%
-0.24ms - +0.49ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local21.96ms - 22.20ms-unsure 🔍
-1% - +0%
-0.32ms - +0.06ms
preact-main22.06ms - 22.35msunsure 🔍
-0% - +1%
-0.06ms - +0.32ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local20.56ms - 21.19ms-unsure 🔍
-2% - +2%
-0.36ms - +0.51ms
preact-main20.50ms - 21.10msunsure 🔍
-2% - +2%
-0.51ms - +0.36ms
-
text-update
  • Browser: chrome-headless
  • Sample size: 230
  • Built by: CI #4121
  • Commit: 532efc3

duration

VersionAvg timevs preact-localvs preact-main
preact-local2.10ms - 2.22ms-unsure 🔍
-2% - +6%
-0.04ms - +0.13ms
preact-main2.05ms - 2.17msunsure 🔍
-6% - +2%
-0.13ms - +0.04ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.10ms - 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.77ms - 34.41ms-unsure 🔍
-1% - +1%
-0.38ms - +0.47ms
preact-main33.76ms - 34.33msunsure 🔍
-1% - +1%
-0.47ms - +0.38ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.22ms - 1.22ms-unsure 🔍
-2% - +0%
-0.02ms - +0.00ms
preact-main1.22ms - 1.24msunsure 🔍
-0% - +2%
-0.00ms - +0.02ms
-
update10th1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local32.44ms - 33.70ms-unsure 🔍
-2% - +4%
-0.57ms - +1.20ms
preact-main32.13ms - 33.38msunsure 🔍
-4% - +2%
-1.20ms - +0.57ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.47ms - 3.50ms-unsure 🔍
-0% - +1%
-0.01ms - +0.02ms
preact-main3.47ms - 3.49msunsure 🔍
-1% - +0%
-0.02ms - +0.01ms
-

tachometer-reporter-action v2 for CI

Copy link

github-actions bot commented Nov 29, 2024

Size Change: +52 B (+0.08%)

Total Size: 62.6 kB

Filename Size Change
dist/preact.js 4.74 kB +7 B (+0.15%)
dist/preact.min.js 4.76 kB +13 B (+0.27%)
dist/preact.min.module.js 4.77 kB +2 B (+0.04%)
dist/preact.min.umd.js 4.79 kB +12 B (+0.25%)
dist/preact.module.js 4.76 kB +6 B (+0.13%)
dist/preact.umd.js 4.8 kB +12 B (+0.25%)
ℹ️ 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 Nov 29, 2024

Coverage Status

coverage: 99.617% (+0.001%) from 99.616%
when pulling 532efc3 on move-things-to-constants
into cfd2f41 on main.

@JoviDeCroock
Copy link
Member Author

Memory bump seems worth the bytes

@JoviDeCroock JoviDeCroock merged commit 99e5e04 into main Nov 29, 2024
13 checks passed
@JoviDeCroock JoviDeCroock deleted the move-things-to-constants branch November 29, 2024 19:14
@JoviDeCroock JoviDeCroock mentioned this pull request Dec 1, 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