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

perf(core): test perf of skipping some lifecycle hooks for perf #4366

Merged
merged 3 commits into from May 23, 2024

Conversation

JoviDeCroock
Copy link
Member

@JoviDeCroock JoviDeCroock commented Apr 30, 2024

The main thinking behind this is that we are accessing the _component megamorphic object less resulting in better performance.

This leaves four accessors behind

  • contextType - our provider is a functional component
  • shouldComponentUpdate - our provider component uses this
  • componentWillUnmount - our provider component uses this
  • componentDidUpdate - this is used in the useState hook

Copy link

github-actions bot commented Apr 30, 2024

📊 Tachometer Benchmark Results

Summary

duration

  • create10k: unsure 🔍 -1% - +0% (-7.89ms - +3.02ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +1% (-0.08ms - +0.17ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -1% - +3% (-0.63ms - +1.94ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -4% - +4% (-0.52ms - +0.62ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -3% - +1% (-1.95ms - +0.59ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -5% - +0% (-0.10ms - +0.01ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -4% - +3% (-1.16ms - +0.80ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -5% - +5% (-1.50ms - +1.52ms)
    preact-local vs preact-main

usedJSHeapSize

  • create10k: faster ✔ 1% - 1% (0.40ms - 0.40ms)
    preact-local vs preact-main
  • filter-list: faster ✔ 2% - 2% (0.03ms - 0.04ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -2% - +3% (-0.32ms - +0.49ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • replace1k: faster ✔ 2% - 3% (0.07ms - 0.12ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 +0% - +0% (+0.00ms - +0.00ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -0% - -0% (-0.01ms - -0.00ms)
    preact-local vs preact-main
  • update10th1k: faster ✔ 1% - 1% (0.03ms - 0.03ms)
    preact-local vs preact-main

Results

create10k

duration

VersionAvg timevs preact-localvs preact-main
preact-local899.67ms - 907.94ms-unsure 🔍
-1% - +0%
-7.89ms - +3.02ms
preact-main902.68ms - 909.79msunsure 🔍
-0% - +1%
-3.02ms - +7.89ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local26.91ms - 26.91ms-faster ✔
1% - 1%
0.40ms - 0.40ms
preact-main27.31ms - 27.31msslower ❌
1% - 1%
0.40ms - 0.40ms
-
filter-list

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.80ms - 16.98ms-unsure 🔍
-0% - +1%
-0.08ms - +0.17ms
preact-main16.76ms - 16.93msunsure 🔍
-1% - +0%
-0.17ms - +0.08ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.72ms - 1.73ms-faster ✔
2% - 2%
0.03ms - 0.04ms
preact-main1.76ms - 1.76msslower ❌
2% - 2%
0.03ms - 0.04ms
-
hydrate1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local73.27ms - 75.50ms-unsure 🔍
-1% - +3%
-0.63ms - +1.94ms
preact-main73.10ms - 74.36msunsure 🔍
-3% - +1%
-1.94ms - +0.63ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local14.33ms - 14.96ms-unsure 🔍
-2% - +3%
-0.32ms - +0.49ms
preact-main14.31ms - 14.82msunsure 🔍
-3% - +2%
-0.49ms - +0.32ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local13.84ms - 14.53ms-unsure 🔍
-4% - +4%
-0.52ms - +0.62ms
preact-main13.68ms - 14.60msunsure 🔍
-4% - +4%
-0.62ms - +0.52ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local4.94ms - 4.95ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main4.94ms - 4.95msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
replace1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local70.35ms - 71.90ms-unsure 🔍
-3% - +1%
-1.95ms - +0.59ms
preact-main70.79ms - 72.81msunsure 🔍
-1% - +3%
-0.59ms - +1.95ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.70ms - 3.73ms-faster ✔
2% - 3%
0.07ms - 0.12ms
preact-main3.79ms - 3.82msslower ❌
2% - 3%
0.07ms - 0.12ms
-

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local29.66ms - 30.33ms-unsure 🔍
-3% - +1%
-0.82ms - +0.19ms
preact-main29.93ms - 30.68msunsure 🔍
-1% - +3%
-0.19ms - +0.82ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local34.27ms - 36.06ms-unsure 🔍
-4% - +3%
-1.44ms - +1.02ms
preact-main34.54ms - 36.22msunsure 🔍
-3% - +4%
-1.02ms - +1.44ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local26.17ms - 26.88ms-unsure 🔍
-3% - +1%
-0.67ms - +0.37ms
preact-main26.29ms - 27.06msunsure 🔍
-1% - +3%
-0.37ms - +0.67ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local24.41ms - 25.41ms-unsure 🔍
-5% - +1%
-1.37ms - +0.14ms
preact-main24.96ms - 26.08msunsure 🔍
-1% - +6%
-0.14ms - +1.37ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local28.15ms - 29.77ms-slower ❌
1% - 9%
0.27ms - 2.54ms
preact-main26.75ms - 28.35msfaster ✔
1% - 9%
0.27ms - 2.54ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local24.43ms - 25.50ms-unsure 🔍
-2% - +4%
-0.48ms - +1.04ms
preact-main24.14ms - 25.22msunsure 🔍
-4% - +2%
-1.04ms - +0.48ms
-
text-update

duration

VersionAvg timevs preact-localvs preact-main
preact-local1.96ms - 2.04ms-unsure 🔍
-5% - +0%
-0.10ms - +0.01ms
preact-main2.01ms - 2.08msunsure 🔍
-0% - +5%
-0.01ms - +0.10ms
-

usedJSHeapSize

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

duration

VersionAvg timevs preact-localvs preact-main
preact-local28.27ms - 29.75ms-unsure 🔍
-4% - +3%
-1.16ms - +0.80ms
preact-main28.55ms - 29.83msunsure 🔍
-3% - +4%
-0.80ms - +1.16ms
-

usedJSHeapSize

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

duration

VersionAvg timevs preact-localvs preact-main
preact-local29.81ms - 31.70ms-unsure 🔍
-5% - +5%
-1.50ms - +1.52ms
preact-main29.58ms - 31.91msunsure 🔍
-5% - +5%
-1.52ms - +1.50ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.71ms - 3.71ms-faster ✔
1% - 1%
0.03ms - 0.03ms
preact-main3.74ms - 3.74msslower ❌
1% - 1%
0.03ms - 0.03ms
-

tachometer-reporter-action v2 for Benchmarks

Copy link

github-actions bot commented Apr 30, 2024

Size Change: +51 B (+0.08%)

Total Size: 61.6 kB

Filename Size Change
dist/preact.js 4.67 kB +8 B (+0.17%)
dist/preact.min.js 4.7 kB +9 B (+0.19%)
dist/preact.min.module.js 4.69 kB +9 B (+0.19%)
dist/preact.min.umd.js 4.72 kB +9 B (+0.19%)
dist/preact.module.js 4.68 kB +7 B (+0.15%)
dist/preact.umd.js 4.74 kB +9 B (+0.19%)
ℹ️ View Unchanged
Filename Size
compat/dist/compat.js 4.09 kB
compat/dist/compat.module.js 4.01 kB
compat/dist/compat.umd.js 4.14 kB
debug/dist/debug.js 3.71 kB
debug/dist/debug.module.js 3.71 kB
debug/dist/debug.umd.js 3.79 kB
devtools/dist/devtools.js 231 B
devtools/dist/devtools.module.js 240 B
devtools/dist/devtools.umd.js 314 B
hooks/dist/hooks.js 1.55 kB
hooks/dist/hooks.module.js 1.59 kB
hooks/dist/hooks.umd.js 1.63 kB
jsx-runtime/dist/jsxRuntime.js 976 B
jsx-runtime/dist/jsxRuntime.module.js 949 B
jsx-runtime/dist/jsxRuntime.umd.js 1.06 kB
test-utils/dist/testUtils.js 453 B
test-utils/dist/testUtils.module.js 454 B
test-utils/dist/testUtils.umd.js 536 B

compressed-size-action

@coveralls
Copy link

coveralls commented Apr 30, 2024

Coverage Status

coverage: 99.611% (+0.001%) from 99.61%
when pulling a0f1f7c on test-skipping-lifecycles-for-funcs
into 8d228d2 on main.

@JoviDeCroock JoviDeCroock changed the base branch from main to breaking-changes-11 April 30, 2024 07:39
@JoviDeCroock JoviDeCroock changed the base branch from breaking-changes-11 to main May 21, 2024 19:03
Copy link
Member

@developit developit left a comment

Choose a reason for hiding this comment

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

nice find! this also more closely matched what we have in 11 IIRC

@JoviDeCroock JoviDeCroock changed the title major(core): test perf of skipping some lifecycle hooks for perf perf(core): test perf of skipping some lifecycle hooks for perf May 23, 2024
@JoviDeCroock JoviDeCroock merged commit 4ddd8fc into main May 23, 2024
13 checks passed
@JoviDeCroock JoviDeCroock deleted the test-skipping-lifecycles-for-funcs branch May 23, 2024 06:30
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