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

golf: Switch === to == in a few places where not needed #4157

Merged
merged 1 commit into from
Oct 9, 2023

Conversation

rschristian
Copy link
Member

Sort of a follow-up to #4152, I don't believe there's a need for === in .constructor or typeof checks, and locally I saw a 3-4 byte reduction that I'd like to check.

@github-actions
Copy link

github-actions bot commented Oct 9, 2023

📊 Tachometer Benchmark Results

Summary

duration

  • 02_replace1k: unsure 🔍 -4% - +2% (-5.37ms - +3.07ms)
    preact-local vs preact-main
  • 03_update10th1k_x16: unsure 🔍 -4% - +3% (-1.70ms - +1.05ms)
    preact-local vs preact-main
  • 07_create10k: unsure 🔍 -1% - +0% (-10.73ms - +1.36ms)
    preact-local vs preact-main
  • filter_list: unsure 🔍 -3% - +1% (-0.67ms - +0.16ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -1% - +1% (-0.83ms - +1.37ms)
    preact-local vs preact-main
  • many_updates: unsure 🔍 -1% - +3% (-0.31ms - +0.74ms)
    preact-local vs preact-main
  • text_update: unsure 🔍 -6% - +6% (-0.25ms - +0.23ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -2% - +3% (-0.81ms - +1.73ms)
    preact-local vs preact-main

usedJSHeapSize

  • 02_replace1k: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-main
  • 03_update10th1k_x16: unsure 🔍 -0% - +0% (-0.01ms - +0.00ms)
    preact-local vs preact-main
  • 07_create10k: unsure 🔍 -0% - +0% (-0.00ms - +0.01ms)
    preact-local vs preact-main
  • filter_list: unsure 🔍 -2% - +2% (-0.02ms - +0.03ms)
    preact-local vs preact-main
  • hydrate1k: faster ✔ 0% - 1% (0.01ms - 0.03ms)
    preact-local vs preact-main
  • many_updates: unsure 🔍 -1% - +0% (-0.03ms - +0.02ms)
    preact-local vs preact-main
  • text_update: unsure 🔍 -4% - +2% (-0.02ms - +0.01ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main

Results

02_replace1k

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main148.15ms - 154.13ms-unsure 🔍
-2% - +4%
-3.07ms - +5.37ms
unsure 🔍
-3% - +3%
-4.72ms - +4.21ms
preact-local147.02ms - 152.96msunsure 🔍
-4% - +2%
-5.37ms - +3.07ms
-unsure 🔍
-4% - +2%
-5.86ms - +3.04ms
preact-hooks148.08ms - 154.71msunsure 🔍
-3% - +3%
-4.21ms - +4.72ms
unsure 🔍
-2% - +4%
-3.04ms - +5.86ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main3.29ms - 3.31ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
faster ✔
0% - 1%
0.01ms - 0.03ms
preact-local3.29ms - 3.30msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-faster ✔
0% - 1%
0.01ms - 0.02ms
preact-hooks3.31ms - 3.32msslower ❌
0% - 1%
0.01ms - 0.03ms
slower ❌
0% - 1%
0.01ms - 0.02ms
-

run-warmup-0

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main46.20ms - 48.09ms-unsure 🔍
-5% - +2%
-2.42ms - +0.94ms
faster ✔
1% - 8%
0.41ms - 4.16ms
preact-local46.49ms - 49.28msunsure 🔍
-2% - +5%
-0.94ms - +2.42ms
-unsure 🔍
-7% - +1%
-3.68ms - +0.60ms
preact-hooks47.80ms - 51.06msslower ❌
1% - 9%
0.41ms - 4.16ms
unsure 🔍
-1% - +8%
-0.60ms - +3.68ms
-

run-warmup-1

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main56.31ms - 58.41ms-unsure 🔍
-4% - +1%
-2.27ms - +0.88ms
unsure 🔍
-5% - +1%
-2.85ms - +0.37ms
preact-local56.88ms - 59.23msunsure 🔍
-2% - +4%
-0.88ms - +2.27ms
-unsure 🔍
-4% - +2%
-2.24ms - +1.15ms
preact-hooks57.38ms - 59.82msunsure 🔍
-1% - +5%
-0.37ms - +2.85ms
unsure 🔍
-2% - +4%
-1.15ms - +2.24ms
-

run-warmup-2

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main44.80ms - 46.20ms-unsure 🔍
-2% - +3%
-0.73ms - +1.51ms
unsure 🔍
-3% - +2%
-1.33ms - +0.96ms
preact-local44.23ms - 45.98msunsure 🔍
-3% - +2%
-1.51ms - +0.73ms
-unsure 🔍
-4% - +1%
-1.84ms - +0.68ms
preact-hooks44.78ms - 46.60msunsure 🔍
-2% - +3%
-0.96ms - +1.33ms
unsure 🔍
-2% - +4%
-0.68ms - +1.84ms
-

run-warmup-3

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main38.49ms - 39.40ms-unsure 🔍
-2% - +1%
-0.87ms - +0.30ms
unsure 🔍
-3% - +1%
-1.32ms - +0.37ms
preact-local38.86ms - 39.60msunsure 🔍
-1% - +2%
-0.30ms - +0.87ms
-unsure 🔍
-3% - +2%
-0.99ms - +0.61ms
preact-hooks38.71ms - 40.14msunsure 🔍
-1% - +3%
-0.37ms - +1.32ms
unsure 🔍
-2% - +3%
-0.61ms - +0.99ms
-

run-warmup-4

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main46.98ms - 48.64ms-unsure 🔍
-4% - +1%
-1.99ms - +0.49ms
unsure 🔍
-2% - +3%
-0.76ms - +1.28ms
preact-local47.64ms - 49.49msunsure 🔍
-1% - +4%
-0.49ms - +1.99ms
-unsure 🔍
-0% - +4%
-0.09ms - +2.11ms
preact-hooks46.96ms - 48.14msunsure 🔍
-3% - +2%
-1.28ms - +0.76ms
unsure 🔍
-4% - +0%
-2.11ms - +0.09ms
-

run-final

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main42.18ms - 48.70ms-unsure 🔍
-5% - +17%
-1.85ms - +7.10ms
unsure 🔍
-9% - +13%
-3.96ms - +5.61ms
preact-local39.75ms - 45.89msunsure 🔍
-15% - +4%
-7.10ms - +1.85ms
-unsure 🔍
-14% - +6%
-6.46ms - +2.86ms
preact-hooks41.11ms - 48.12msunsure 🔍
-12% - +9%
-5.61ms - +3.96ms
unsure 🔍
-7% - +15%
-2.86ms - +6.46ms
-
03_update10th1k_x16

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main37.55ms - 39.48ms-unsure 🔍
-3% - +4%
-1.05ms - +1.70ms
unsure 🔍
-2% - +5%
-0.73ms - +1.80ms
preact-local37.20ms - 39.18msunsure 🔍
-4% - +3%
-1.70ms - +1.05ms
-unsure 🔍
-3% - +4%
-1.07ms - +1.49ms
preact-hooks37.16ms - 38.80msunsure 🔍
-5% - +2%
-1.80ms - +0.73ms
unsure 🔍
-4% - +3%
-1.49ms - +1.07ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main3.24ms - 3.25ms-unsure 🔍
-0% - +0%
-0.00ms - +0.01ms
faster ✔
0% - 1%
0.01ms - 0.03ms
preact-local3.24ms - 3.25msunsure 🔍
-0% - +0%
-0.01ms - +0.00ms
-faster ✔
0% - 1%
0.02ms - 0.03ms
preact-hooks3.26ms - 3.28msslower ❌
0% - 1%
0.01ms - 0.03ms
slower ❌
0% - 1%
0.02ms - 0.03ms
-
07_create10k

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main1260.89ms - 1270.68ms-unsure 🔍
-0% - +1%
-1.36ms - +10.73ms
unsure 🔍
-1% - +0%
-8.71ms - +4.54ms
preact-local1257.55ms - 1264.65msunsure 🔍
-1% - +0%
-10.73ms - +1.36ms
-faster ✔
0% - 1%
1.07ms - 12.47ms
preact-hooks1263.41ms - 1272.34msunsure 🔍
-0% - +1%
-4.54ms - +8.71ms
slower ❌
0% - 1%
1.07ms - 12.47ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main25.90ms - 25.91ms-unsure 🔍
-0% - +0%
-0.01ms - +0.00ms
unsure 🔍
-0% - -0%
-0.03ms - -0.02ms
preact-local25.91ms - 25.91msunsure 🔍
-0% - +0%
-0.00ms - +0.01ms
-unsure 🔍
-0% - -0%
-0.02ms - -0.02ms
preact-hooks25.93ms - 25.93msunsure 🔍
+0% - +0%
+0.02ms - +0.03ms
unsure 🔍
+0% - +0%
+0.02ms - +0.02ms
-
filter_list

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main23.59ms - 24.32ms-unsure 🔍
-1% - +3%
-0.16ms - +0.67ms
unsure 🔍
-2% - +3%
-0.57ms - +0.60ms
preact-local23.52ms - 23.89msunsure 🔍
-3% - +1%
-0.67ms - +0.16ms
-unsure 🔍
-3% - +1%
-0.73ms - +0.25ms
preact-hooks23.49ms - 24.39msunsure 🔍
-2% - +2%
-0.60ms - +0.57ms
unsure 🔍
-1% - +3%
-0.25ms - +0.73ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main1.40ms - 1.44ms-unsure 🔍
-2% - +2%
-0.03ms - +0.02ms
faster ✔
0% - 4%
0.00ms - 0.05ms
preact-local1.40ms - 1.44msunsure 🔍
-2% - +2%
-0.02ms - +0.03ms
-unsure 🔍
-4% - +0%
-0.05ms - +0.00ms
preact-hooks1.43ms - 1.46msslower ❌
0% - 4%
0.00ms - 0.05ms
unsure 🔍
-0% - +4%
-0.00ms - +0.05ms
-
hydrate1k

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main119.48ms - 120.83ms-unsure 🔍
-1% - +1%
-1.37ms - +0.83ms
unsure 🔍
-2% - +1%
-2.49ms - +0.65ms
preact-local119.56ms - 121.30msunsure 🔍
-1% - +1%
-0.83ms - +1.37ms
-unsure 🔍
-2% - +1%
-2.31ms - +1.02ms
preact-hooks119.66ms - 122.49msunsure 🔍
-1% - +2%
-0.65ms - +2.49ms
unsure 🔍
-1% - +2%
-1.02ms - +2.31ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main6.06ms - 6.08ms-slower ❌
0% - 1%
0.01ms - 0.03ms
unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
preact-local6.04ms - 6.05msfaster ✔
0% - 1%
0.01ms - 0.03ms
-unsure 🔍
-0% - -0%
-0.03ms - -0.02ms
preact-hooks6.07ms - 6.07msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
unsure 🔍
+0% - +0%
+0.02ms - +0.03ms
-
many_updates

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main25.24ms - 25.91ms-unsure 🔍
-3% - +1%
-0.74ms - +0.31ms
unsure 🔍
-3% - +2%
-0.83ms - +0.42ms
preact-local25.39ms - 26.20msunsure 🔍
-1% - +3%
-0.31ms - +0.74ms
-unsure 🔍
-3% - +3%
-0.65ms - +0.68ms
preact-hooks25.25ms - 26.31msunsure 🔍
-2% - +3%
-0.42ms - +0.83ms
unsure 🔍
-3% - +3%
-0.68ms - +0.65ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main4.42ms - 4.46ms-unsure 🔍
-0% - +1%
-0.02ms - +0.03ms
faster ✔
0% - 1%
0.00ms - 0.05ms
preact-local4.42ms - 4.45msunsure 🔍
-1% - +0%
-0.03ms - +0.02ms
-faster ✔
0% - 1%
0.01ms - 0.06ms
preact-hooks4.45ms - 4.49msslower ❌
0% - 1%
0.00ms - 0.05ms
slower ❌
0% - 1%
0.01ms - 0.06ms
-
text_update

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main3.86ms - 4.21ms-unsure 🔍
-6% - +6%
-0.23ms - +0.25ms
faster ✔
3% - 14%
0.11ms - 0.62ms
preact-local3.86ms - 4.19msunsure 🔍
-6% - +6%
-0.25ms - +0.23ms
-faster ✔
3% - 14%
0.12ms - 0.62ms
preact-hooks4.21ms - 4.58msslower ❌
2% - 16%
0.11ms - 0.62ms
slower ❌
3% - 16%
0.12ms - 0.62ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main0.66ms - 0.69ms-unsure 🔍
-2% - +4%
-0.01ms - +0.02ms
faster ✔
1% - 6%
0.00ms - 0.04ms
preact-local0.65ms - 0.68msunsure 🔍
-4% - +2%
-0.02ms - +0.01ms
-faster ✔
1% - 7%
0.01ms - 0.05ms
preact-hooks0.68ms - 0.71msslower ❌
0% - 6%
0.00ms - 0.04ms
slower ❌
1% - 7%
0.01ms - 0.05ms
-
todo

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main50.53ms - 52.31ms-unsure 🔍
-3% - +2%
-1.73ms - +0.81ms
unsure 🔍
-4% - +0%
-2.34ms - +0.22ms
preact-local50.97ms - 52.79msunsure 🔍
-2% - +3%
-0.81ms - +1.73ms
-unsure 🔍
-4% - +1%
-1.90ms - +0.70ms
preact-hooks51.55ms - 53.41msunsure 🔍
-0% - +5%
-0.22ms - +2.34ms
unsure 🔍
-1% - +4%
-0.70ms - +1.90ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main0.81ms - 0.81ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
3% - 3%
0.02ms - 0.02ms
preact-local0.81ms - 0.81msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
3% - 3%
0.02ms - 0.02ms
preact-hooks0.83ms - 0.83msslower ❌
3% - 3%
0.02ms - 0.02ms
slower ❌
3% - 3%
0.02ms - 0.02ms
-

tachometer-reporter-action v2 for Benchmarks

@coveralls
Copy link

coveralls commented Oct 9, 2023

Coverage Status

coverage: 99.293%. remained the same when pulling f9c848b on golf/double-eq-constructor into 600d8cf on main.

@github-actions
Copy link

github-actions bot commented Oct 9, 2023

Size Change: -12 B (0%)

Total Size: 57.3 kB

Filename Size Change
dist/preact.js 4.42 kB -1 B
dist/preact.min.js 4.46 kB -1 B
dist/preact.min.module.js 4.45 kB -3 B (0%)
dist/preact.min.umd.js 4.48 kB -2 B (0%)
dist/preact.module.js 4.45 kB -3 B (0%)
dist/preact.umd.js 4.49 kB -2 B (0%)
ℹ️ View Unchanged
Filename Size Change
compat/dist/compat.js 3.95 kB 0 B
compat/dist/compat.module.js 3.87 kB 0 B
compat/dist/compat.umd.js 4.01 kB 0 B
debug/dist/debug.js 3.54 kB 0 B
debug/dist/debug.module.js 3.53 kB 0 B
debug/dist/debug.umd.js 3.62 kB 0 B
devtools/dist/devtools.js 231 B 0 B
devtools/dist/devtools.module.js 240 B 0 B
devtools/dist/devtools.umd.js 315 B 0 B
hooks/dist/hooks.js 1.53 kB 0 B
hooks/dist/hooks.module.js 1.56 kB 0 B
hooks/dist/hooks.umd.js 1.62 kB 0 B
jsx-runtime/dist/jsxRuntime.js 360 B 0 B
jsx-runtime/dist/jsxRuntime.module.js 326 B 0 B
jsx-runtime/dist/jsxRuntime.umd.js 441 B 0 B
test-utils/dist/testUtils.js 453 B 0 B
test-utils/dist/testUtils.module.js 454 B 0 B
test-utils/dist/testUtils.umd.js 536 B 0 B

compressed-size-action

@rschristian rschristian changed the title refactor: Switch === to == in a few places where not needed golf: Switch === to == in a few places where not needed Oct 9, 2023
@rschristian rschristian marked this pull request as ready for review October 9, 2023 06:50
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.

Great spot!

@JoviDeCroock JoviDeCroock merged commit 4b1a7e9 into main Oct 9, 2023
15 checks passed
@JoviDeCroock JoviDeCroock deleted the golf/double-eq-constructor branch October 9, 2023 06:57
@JoviDeCroock JoviDeCroock mentioned this pull request Nov 3, 2023
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.

None yet

3 participants