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

fix: avoid bailing in strict equality #3884

Merged
merged 1 commit into from
Feb 4, 2023
Merged

Conversation

JoviDeCroock
Copy link
Member

Fixes #3883

When we are dealing with strict equality we expect the following type of component to bail because of the reference of the vnode being the same in-between renders:

const Parent = (props) => props.children

this component can have an internal update but because we return a static reference to the children we don't have to trickle down the render. We already avoided setting _dirty to false because we knew the static children could be dealing with their own updates, however we did update the props and state to their next one which is counter-intuitive as this would set state = _nextState effectively bailing out of state updates.

@github-actions
Copy link

github-actions bot commented Feb 4, 2023

📊 Tachometer Benchmark Results

Summary

duration

  • 02_replace1k: unsure 🔍 -1% - +2% (-1.94ms - +2.65ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -5% - +1% (-2.84ms - +0.51ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -2% - +0% (-32.98ms - +2.96ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -2% - +3% (-0.61ms - +0.90ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -1% - +3% (-0.91ms - +3.64ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -1% - +4% (-0.21ms - +1.22ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 -1% - +1% (-0.04ms - +0.04ms)
    preact-local vs preact-master
  • todo: unsure 🔍 -1% - +1% (-0.28ms - +0.49ms)
    preact-local vs preact-master

usedJSHeapSize

  • 02_replace1k: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -8% - +2% (-0.84ms - +0.20ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -1% - +0% (-0.04ms - +0.01ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 -0% - -0% (-0.00ms - -0.00ms)
    preact-local vs preact-master
  • todo: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master

Results

02_replace1k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master147.99ms - 150.57ms-unsure 🔍
-2% - +1%
-2.65ms - +1.94ms
unsure 🔍
-2% - +0%
-2.72ms - +0.52ms
preact-local147.73ms - 151.53msunsure 🔍
-1% - +2%
-1.94ms - +2.65ms
-unsure 🔍
-2% - +1%
-2.89ms - +1.39ms
preact-hooks149.40ms - 151.36msunsure 🔍
-0% - +2%
-0.52ms - +2.72ms
unsure 🔍
-1% - +2%
-1.39ms - +2.89ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.41ms - 3.42ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
faster ✔
0% - 1%
0.01ms - 0.03ms
preact-local3.41ms - 3.42msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-faster ✔
0% - 1%
0.01ms - 0.03ms
preact-hooks3.43ms - 3.44msslower ❌
0% - 1%
0.01ms - 0.03ms
slower ❌
0% - 1%
0.01ms - 0.03ms
-

run-warmup-0

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master52.10ms - 54.82ms-unsure 🔍
-5% - +2%
-2.73ms - +1.00ms
unsure 🔍
-6% - +1%
-3.47ms - +0.61ms
preact-local53.05ms - 55.61msunsure 🔍
-2% - +5%
-1.00ms - +2.73ms
-unsure 🔍
-5% - +3%
-2.55ms - +1.42ms
preact-hooks53.38ms - 56.42msunsure 🔍
-1% - +7%
-0.61ms - +3.47ms
unsure 🔍
-3% - +5%
-1.42ms - +2.55ms
-

run-warmup-1

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master69.73ms - 73.96ms-unsure 🔍
-1% - +6%
-0.78ms - +4.29ms
unsure 🔍
-3% - +4%
-2.15ms - +3.13ms
preact-local68.70ms - 71.48msunsure 🔍
-6% - +1%
-4.29ms - +0.78ms
-unsure 🔍
-5% - +1%
-3.36ms - +0.84ms
preact-hooks69.78ms - 72.93msunsure 🔍
-4% - +3%
-3.13ms - +2.15ms
unsure 🔍
-1% - +5%
-0.84ms - +3.36ms
-

run-warmup-2

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master55.38ms - 59.87ms-unsure 🔍
-5% - +4%
-3.13ms - +2.26ms
slower ❌
0% - 11%
0.24ms - 6.08ms
preact-local56.58ms - 59.56msunsure 🔍
-4% - +5%
-2.26ms - +3.13ms
-slower ❌
2% - 11%
1.21ms - 5.98ms
preact-hooks52.61ms - 56.33msfaster ✔
1% - 10%
0.24ms - 6.08ms
faster ✔
2% - 10%
1.21ms - 5.98ms
-

run-warmup-3

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master43.75ms - 46.07ms-unsure 🔍
-3% - +5%
-1.26ms - +2.13ms
faster ✔
0% - 7%
0.17ms - 3.29ms
preact-local43.24ms - 45.71msunsure 🔍
-5% - +3%
-2.13ms - +1.26ms
-faster ✔
1% - 8%
0.55ms - 3.78ms
preact-hooks45.60ms - 47.68msslower ❌
0% - 7%
0.17ms - 3.29ms
slower ❌
1% - 9%
0.55ms - 3.78ms
-

run-warmup-4

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master45.72ms - 47.52ms-unsure 🔍
-2% - +4%
-0.88ms - +1.84ms
faster ✔
1% - 6%
0.48ms - 2.84ms
preact-local45.12ms - 47.16msunsure 🔍
-4% - +2%
-1.84ms - +0.88ms
-faster ✔
2% - 7%
0.87ms - 3.41ms
preact-hooks47.52ms - 49.04msslower ❌
1% - 6%
0.48ms - 2.84ms
slower ❌
2% - 7%
0.87ms - 3.41ms
-

run-final

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master33.15ms - 34.06ms-unsure 🔍
-3% - +1%
-1.17ms - +0.40ms
unsure 🔍
-1% - +2%
-0.31ms - +0.75ms
preact-local33.36ms - 34.63msunsure 🔍
-1% - +3%
-0.40ms - +1.17ms
-unsure 🔍
-0% - +4%
-0.09ms - +1.30ms
preact-hooks33.12ms - 33.66msunsure 🔍
-2% - +1%
-0.75ms - +0.31ms
unsure 🔍
-4% - +0%
-1.30ms - +0.09ms
-
03_update10th1k_x16

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master56.99ms - 59.30ms-unsure 🔍
-1% - +5%
-0.51ms - +2.84ms
unsure 🔍
-1% - +4%
-0.75ms - +2.37ms
preact-local55.76ms - 58.19msunsure 🔍
-5% - +1%
-2.84ms - +0.51ms
-unsure 🔍
-3% - +2%
-1.96ms - +1.25ms
preact-hooks56.29ms - 58.38msunsure 🔍
-4% - +1%
-2.37ms - +0.75ms
unsure 🔍
-2% - +3%
-1.25ms - +1.96ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.28ms - 3.28ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
0% - 1%
0.01ms - 0.02ms
preact-local3.28ms - 3.28msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
0% - 1%
0.01ms - 0.02ms
preact-hooks3.30ms - 3.30msslower ❌
0% - 1%
0.01ms - 0.02ms
slower ❌
0% - 1%
0.01ms - 0.02ms
-
07_create10k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1538.04ms - 1563.69ms-unsure 🔍
-0% - +2%
-2.96ms - +32.98ms
unsure 🔍
-1% - +2%
-9.20ms - +25.72ms
preact-local1523.27ms - 1548.45msunsure 🔍
-2% - +0%
-32.98ms - +2.96ms
-unsure 🔍
-2% - +1%
-24.04ms - +10.54ms
preact-hooks1530.76ms - 1554.46msunsure 🔍
-2% - +1%
-25.72ms - +9.20ms
unsure 🔍
-1% - +2%
-10.54ms - +24.04ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master25.36ms - 25.36ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
unsure 🔍
-0% - -0%
-0.02ms - -0.02ms
preact-local25.36ms - 25.36msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-unsure 🔍
-0% - -0%
-0.02ms - -0.02ms
preact-hooks25.38ms - 25.38msunsure 🔍
+0% - +0%
+0.02ms - +0.02ms
unsure 🔍
+0% - +0%
+0.02ms - +0.02ms
-
filter_list

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master29.71ms - 30.70ms-unsure 🔍
-3% - +2%
-0.90ms - +0.61ms
unsure 🔍
-3% - +1%
-0.91ms - +0.44ms
preact-local29.78ms - 30.92msunsure 🔍
-2% - +3%
-0.61ms - +0.90ms
-unsure 🔍
-3% - +2%
-0.82ms - +0.64ms
preact-hooks29.98ms - 30.89msunsure 🔍
-1% - +3%
-0.44ms - +0.91ms
unsure 🔍
-2% - +3%
-0.64ms - +0.82ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.59ms - 1.59ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
1% - 1%
0.02ms - 0.02ms
preact-local1.59ms - 1.59msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
1% - 1%
0.02ms - 0.02ms
preact-hooks1.61ms - 1.61msslower ❌
1% - 1%
0.02ms - 0.02ms
slower ❌
1% - 1%
0.02ms - 0.02ms
-
hydrate1k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master131.98ms - 135.06ms-unsure 🔍
-3% - +1%
-3.64ms - +0.91ms
unsure 🔍
-3% - +0%
-3.73ms - +0.40ms
preact-local133.21ms - 136.56msunsure 🔍
-1% - +3%
-0.91ms - +3.64ms
-unsure 🔍
-2% - +1%
-2.46ms - +1.87ms
preact-hooks133.81ms - 136.56msunsure 🔍
-0% - +3%
-0.40ms - +3.73ms
unsure 🔍
-1% - +2%
-1.87ms - +2.46ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master10.46ms - 11.19ms-unsure 🔍
-2% - +8%
-0.20ms - +0.84ms
unsure 🔍
-9% - +0%
-1.07ms - +0.06ms
preact-local10.14ms - 10.87msunsure 🔍
-8% - +2%
-0.84ms - +0.20ms
-faster ✔
2% - 12%
0.25ms - 1.39ms
preact-hooks10.90ms - 11.75msunsure 🔍
-1% - +10%
-0.06ms - +1.07ms
slower ❌
2% - 13%
0.25ms - 1.39ms
-
many_updates

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master33.94ms - 34.98ms-unsure 🔍
-3% - +1%
-1.22ms - +0.21ms
unsure 🔍
-3% - +1%
-1.08ms - +0.32ms
preact-local34.47ms - 35.45msunsure 🔍
-1% - +4%
-0.21ms - +1.22ms
-unsure 🔍
-2% - +2%
-0.56ms - +0.80ms
preact-hooks34.37ms - 35.31msunsure 🔍
-1% - +3%
-0.32ms - +1.08ms
unsure 🔍
-2% - +2%
-0.80ms - +0.56ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master4.60ms - 4.63ms-unsure 🔍
-0% - +1%
-0.01ms - +0.04ms
faster ✔
1% - 1%
0.03ms - 0.06ms
preact-local4.59ms - 4.62msunsure 🔍
-1% - +0%
-0.04ms - +0.01ms
-faster ✔
1% - 2%
0.04ms - 0.08ms
preact-hooks4.66ms - 4.66msslower ❌
1% - 1%
0.03ms - 0.06ms
slower ❌
1% - 2%
0.04ms - 0.08ms
-
text_update

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master2.94ms - 3.00ms-unsure 🔍
-1% - +1%
-0.04ms - +0.04ms
faster ✔
3% - 6%
0.11ms - 0.18ms
preact-local2.94ms - 3.00msunsure 🔍
-1% - +1%
-0.04ms - +0.04ms
-faster ✔
3% - 6%
0.11ms - 0.18ms
preact-hooks3.09ms - 3.13msslower ❌
4% - 6%
0.11ms - 0.18ms
slower ❌
4% - 6%
0.11ms - 0.18ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master0.82ms - 0.82ms-unsure 🔍
+0% - +0%
+0.00ms - +0.00ms
faster ✔
2% - 2%
0.01ms - 0.01ms
preact-local0.82ms - 0.82msunsure 🔍
-0% - -0%
-0.00ms - -0.00ms
-faster ✔
2% - 2%
0.01ms - 0.01ms
preact-hooks0.83ms - 0.83msslower ❌
2% - 2%
0.01ms - 0.01ms
slower ❌
2% - 2%
0.01ms - 0.01ms
-
todo

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master54.12ms - 54.68ms-unsure 🔍
-1% - +1%
-0.49ms - +0.28ms
faster ✔
2% - 4%
1.18ms - 2.09ms
preact-local54.25ms - 54.78msunsure 🔍
-1% - +1%
-0.28ms - +0.49ms
-faster ✔
2% - 4%
1.08ms - 1.97ms
preact-hooks55.68ms - 56.40msslower ❌
2% - 4%
1.18ms - 2.09ms
slower ❌
2% - 4%
1.08ms - 1.97ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.09ms - 1.09ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
2% - 2%
0.02ms - 0.02ms
preact-local1.09ms - 1.09msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
2% - 2%
0.02ms - 0.03ms
preact-hooks1.11ms - 1.12msslower ❌
2% - 2%
0.02ms - 0.02ms
slower ❌
2% - 2%
0.02ms - 0.03ms
-

tachometer-reporter-action v2 for Benchmarks

@coveralls
Copy link

coveralls commented Feb 4, 2023

Coverage Status

Coverage: 99.543%. Remained the same when pulling da8180f on fix-state-equality into 6e2e952 on master.

@github-actions
Copy link

github-actions bot commented Feb 4, 2023

Size Change: -13 B (0%)

Total Size: 53.9 kB

Filename Size Change
dist/preact.js 4.21 kB -2 B (0%)
dist/preact.min.js 4.24 kB -2 B (0%)
dist/preact.min.module.js 4.24 kB -2 B (0%)
dist/preact.min.umd.js 4.27 kB -2 B (0%)
dist/preact.module.js 4.23 kB -3 B (0%)
dist/preact.umd.js 4.29 kB -2 B (0%)
ℹ️ View Unchanged
Filename Size Change
compat/dist/compat.js 3.81 kB 0 B
compat/dist/compat.module.js 3.75 kB 0 B
compat/dist/compat.umd.js 3.87 kB 0 B
debug/dist/debug.js 3 kB 0 B
debug/dist/debug.module.js 3.01 kB 0 B
debug/dist/debug.umd.js 3.08 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.49 kB 0 B
hooks/dist/hooks.module.js 1.52 kB 0 B
hooks/dist/hooks.umd.js 1.57 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 442 B 0 B
test-utils/dist/testUtils.module.js 444 B 0 B
test-utils/dist/testUtils.umd.js 526 B 0 B

compressed-size-action

@JoviDeCroock JoviDeCroock merged commit 8a30bcc into master Feb 4, 2023
@JoviDeCroock JoviDeCroock deleted the fix-state-equality branch February 4, 2023 17:22
JoviDeCroock added a commit that referenced this pull request Jan 12, 2024
* backport #3871

* port test from #3884 functionality seems to work in v11

* backport #3880

* backport #3875

* backport #3862

* add todo for #3801

* backport #3868

* backport #3867

* backport #3863

* add todo for #3856

* backport #3844

* backport #3816

* backport #3888

* backport #3889
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants