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: address scenario where we would crash when replacing a matched vnode with null #4281

Merged
merged 5 commits into from
Feb 16, 2024

Conversation

JoviDeCroock
Copy link
Member

@JoviDeCroock JoviDeCroock commented Feb 16, 2024

Fixes #4274
Fixes #4194

This change adds one crucial change to our child-diffing, when an oldVNode has already been matched we won't unmount it

Copy link

github-actions bot commented Feb 16, 2024

📊 Tachometer Benchmark Results

Summary

duration

  • 02_replace1k: unsure 🔍 -0% - +1% (-0.34ms - +1.04ms)
    preact-local vs preact-main
  • 03_update10th1k_x16: unsure 🔍 -6% - +2% (-1.72ms - +0.54ms)
    preact-local vs preact-main
  • 07_create10k: unsure 🔍 -2% - +0% (-17.65ms - +3.17ms)
    preact-local vs preact-main
  • filter_list: unsure 🔍 -0% - +0% (-0.02ms - +0.04ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -2% - +1% (-1.62ms - +1.17ms)
    preact-local vs preact-main
  • many_updates: unsure 🔍 -3% - +3% (-0.46ms - +0.59ms)
    preact-local vs preact-main
  • text_update: unsure 🔍 -3% - +5% (-0.09ms - +0.11ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -0% - +1% (-0.11ms - +0.19ms)
    preact-local vs preact-main

usedJSHeapSize

  • 02_replace1k: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    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.00ms)
    preact-local vs preact-main
  • filter_list: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • many_updates: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • text_update: unsure 🔍 +0% - +0% (+0.00ms - +0.00ms)
    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-main75.06ms - 75.77ms-unsure 🔍
-1% - +0%
-1.04ms - +0.34ms
faster ✔
0% - 2%
0.28ms - 1.88ms
preact-local75.17ms - 76.36msunsure 🔍
-0% - +1%
-0.34ms - +1.04ms
-unsure 🔍
-2% - +0%
-1.66ms - +0.20ms
preact-hooks75.78ms - 77.22msslower ❌
0% - 3%
0.28ms - 1.88ms
unsure 🔍
-0% - +2%
-0.20ms - +1.66ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main3.48ms - 3.48ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
1% - 1%
0.02ms - 0.03ms
preact-local3.48ms - 3.48msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
1% - 1%
0.02ms - 0.03ms
preact-hooks3.50ms - 3.50msslower ❌
1% - 1%
0.02ms - 0.03ms
slower ❌
1% - 1%
0.02ms - 0.03ms
-

run-warmup-0

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main29.64ms - 30.56ms-unsure 🔍
-2% - +2%
-0.70ms - +0.60ms
unsure 🔍
-4% - +0%
-1.20ms - +0.07ms
preact-local29.69ms - 30.61msunsure 🔍
-2% - +2%
-0.60ms - +0.70ms
-unsure 🔍
-4% - +0%
-1.15ms - +0.12ms
preact-hooks30.23ms - 31.11msunsure 🔍
-0% - +4%
-0.07ms - +1.20ms
unsure 🔍
-0% - +4%
-0.12ms - +1.15ms
-

run-warmup-1

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main37.71ms - 39.42ms-unsure 🔍
-3% - +3%
-1.00ms - +1.26ms
faster ✔
2% - 7%
0.73ms - 2.71ms
preact-local37.70ms - 39.18msunsure 🔍
-3% - +3%
-1.26ms - +1.00ms
-faster ✔
2% - 7%
0.96ms - 2.74ms
preact-hooks39.79ms - 40.79msslower ❌
2% - 7%
0.73ms - 2.71ms
slower ❌
2% - 7%
0.96ms - 2.74ms
-

run-warmup-2

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main25.68ms - 25.89ms-unsure 🔍
-1% - +1%
-0.25ms - +0.18ms
unsure 🔍
-1% - +0%
-0.23ms - +0.07ms
preact-local25.63ms - 26.01msunsure 🔍
-1% - +1%
-0.18ms - +0.25ms
-unsure 🔍
-1% - +1%
-0.26ms - +0.17ms
preact-hooks25.76ms - 25.98msunsure 🔍
-0% - +1%
-0.07ms - +0.23ms
unsure 🔍
-1% - +1%
-0.17ms - +0.26ms
-

run-warmup-3

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main24.64ms - 25.70ms-unsure 🔍
-2% - +4%
-0.43ms - +1.04ms
unsure 🔍
-4% - +2%
-0.98ms - +0.63ms
preact-local24.36ms - 25.37msunsure 🔍
-4% - +2%
-1.04ms - +0.43ms
-unsure 🔍
-5% - +1%
-1.27ms - +0.31ms
preact-hooks24.74ms - 25.95msunsure 🔍
-3% - +4%
-0.63ms - +0.98ms
unsure 🔍
-1% - +5%
-0.31ms - +1.27ms
-

run-warmup-4

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main27.31ms - 28.83ms-slower ❌
2% - 10%
0.48ms - 2.55ms
unsure 🔍
-5% - +1%
-1.48ms - +0.30ms
preact-local25.86ms - 27.25msfaster ✔
2% - 9%
0.48ms - 2.55ms
-faster ✔
4% - 10%
1.27ms - 2.94ms
preact-hooks28.20ms - 29.12msunsure 🔍
-1% - +5%
-0.30ms - +1.48ms
slower ❌
5% - 11%
1.27ms - 2.94ms
-

run-final

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main22.60ms - 23.22ms-unsure 🔍
-3% - +2%
-0.64ms - +0.35ms
faster ✔
0% - 5%
0.07ms - 1.16ms
preact-local22.67ms - 23.44msunsure 🔍
-2% - +3%
-0.35ms - +0.64ms
-unsure 🔍
-4% - +1%
-1.06ms - +0.13ms
preact-hooks23.07ms - 23.97msslower ❌
0% - 5%
0.07ms - 1.16ms
unsure 🔍
-1% - +5%
-0.13ms - +1.06ms
-
03_update10th1k_x16

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main29.86ms - 31.47ms-unsure 🔍
-2% - +6%
-0.54ms - +1.72ms
unsure 🔍
-2% - +5%
-0.61ms - +1.61ms
preact-local29.29ms - 30.87msunsure 🔍
-6% - +2%
-1.72ms - +0.54ms
-unsure 🔍
-4% - +3%
-1.19ms - +1.01ms
preact-hooks29.41ms - 30.93msunsure 🔍
-5% - +2%
-1.61ms - +0.61ms
unsure 🔍
-3% - +4%
-1.01ms - +1.19ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main3.44ms - 3.44ms-unsure 🔍
-0% - +0%
-0.00ms - +0.01ms
faster ✔
0% - 1%
0.01ms - 0.02ms
preact-local3.43ms - 3.44msunsure 🔍
-0% - +0%
-0.01ms - +0.00ms
-faster ✔
0% - 1%
0.01ms - 0.02ms
preact-hooks3.45ms - 3.46msslower ❌
0% - 1%
0.01ms - 0.02ms
slower ❌
0% - 1%
0.01ms - 0.02ms
-
07_create10k

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main936.46ms - 954.39ms-unsure 🔍
-0% - +2%
-3.17ms - +17.65ms
unsure 🔍
-1% - +2%
-5.07ms - +14.28ms
preact-local932.90ms - 943.47msunsure 🔍
-2% - +0%
-17.65ms - +3.17ms
-unsure 🔍
-1% - +0%
-9.05ms - +3.79ms
preact-hooks937.17ms - 944.46msunsure 🔍
-2% - +1%
-14.28ms - +5.07ms
unsure 🔍
-0% - +1%
-3.79ms - +9.05ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main26.48ms - 26.48ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
unsure 🔍
-0% - -0%
-0.02ms - -0.02ms
preact-local26.48ms - 26.48msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-unsure 🔍
-0% - -0%
-0.02ms - -0.02ms
preact-hooks26.50ms - 26.50msunsure 🔍
+0% - +0%
+0.02ms - +0.02ms
unsure 🔍
+0% - +0%
+0.02ms - +0.02ms
-
filter_list

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main16.56ms - 16.61ms-unsure 🔍
-0% - +0%
-0.04ms - +0.02ms
unsure 🔍
-0% - +0%
-0.03ms - +0.03ms
preact-local16.58ms - 16.62msunsure 🔍
-0% - +0%
-0.02ms - +0.04ms
-unsure 🔍
-0% - +0%
-0.02ms - +0.04ms
preact-hooks16.56ms - 16.60msunsure 🔍
-0% - +0%
-0.03ms - +0.03ms
unsure 🔍
-0% - +0%
-0.04ms - +0.02ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main1.49ms - 1.50ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
1% - 2%
0.02ms - 0.03ms
preact-local1.49ms - 1.50msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
1% - 2%
0.02ms - 0.03ms
preact-hooks1.52ms - 1.52msslower ❌
1% - 2%
0.02ms - 0.03ms
slower ❌
1% - 2%
0.02ms - 0.03ms
-
hydrate1k

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main84.02ms - 86.52ms-unsure 🔍
-1% - +2%
-1.17ms - +1.62ms
unsure 🔍
-2% - +2%
-1.49ms - +1.51ms
preact-local84.43ms - 85.66msunsure 🔍
-2% - +1%
-1.62ms - +1.17ms
-unsure 🔍
-1% - +1%
-1.24ms - +0.81ms
preact-hooks84.44ms - 86.09msunsure 🔍
-2% - +2%
-1.51ms - +1.49ms
unsure 🔍
-1% - +1%
-0.81ms - +1.24ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main6.17ms - 6.18ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
unsure 🔍
-0% - -0%
-0.03ms - -0.02ms
preact-local6.17ms - 6.18msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-unsure 🔍
-0% - -0%
-0.03ms - -0.02ms
preact-hooks6.20ms - 6.20msunsure 🔍
+0% - +0%
+0.02ms - +0.03ms
unsure 🔍
+0% - +0%
+0.02ms - +0.03ms
-
many_updates

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main16.68ms - 17.30ms-unsure 🔍
-3% - +3%
-0.59ms - +0.46ms
unsure 🔍
-1% - +4%
-0.19ms - +0.68ms
preact-local16.64ms - 17.47msunsure 🔍
-3% - +3%
-0.46ms - +0.59ms
-unsure 🔍
-1% - +5%
-0.21ms - +0.82ms
preact-hooks16.45ms - 17.05msunsure 🔍
-4% - +1%
-0.68ms - +0.19ms
unsure 🔍
-5% - +1%
-0.82ms - +0.21ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main4.60ms - 4.60ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
0% - 1%
0.02ms - 0.03ms
preact-local4.60ms - 4.60msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
0% - 1%
0.02ms - 0.03ms
preact-hooks4.62ms - 4.63msslower ❌
0% - 1%
0.02ms - 0.03ms
slower ❌
0% - 1%
0.02ms - 0.03ms
-
text_update

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main2.42ms - 2.56ms-unsure 🔍
-5% - +3%
-0.11ms - +0.09ms
faster ✔
7% - 14%
0.19ms - 0.39ms
preact-local2.43ms - 2.57msunsure 🔍
-3% - +5%
-0.09ms - +0.11ms
-faster ✔
6% - 13%
0.17ms - 0.38ms
preact-hooks2.70ms - 2.85msslower ❌
7% - 16%
0.19ms - 0.39ms
slower ❌
7% - 15%
0.17ms - 0.38ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main0.72ms - 0.72ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
faster ✔
3% - 3%
0.02ms - 0.02ms
preact-local0.72ms - 0.72msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-faster ✔
3% - 3%
0.02ms - 0.02ms
preact-hooks0.75ms - 0.75msslower ❌
3% - 3%
0.02ms - 0.02ms
slower ❌
3% - 3%
0.02ms - 0.02ms
-
todo

duration

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main26.21ms - 26.37ms-unsure 🔍
-1% - +0%
-0.19ms - +0.11ms
faster ✔
3% - 5%
0.70ms - 1.30ms
preact-local26.20ms - 26.45msunsure 🔍
-0% - +1%
-0.11ms - +0.19ms
-faster ✔
2% - 5%
0.65ms - 1.28ms
preact-hooks27.01ms - 27.58msslower ❌
3% - 5%
0.70ms - 1.30ms
slower ❌
2% - 5%
0.65ms - 1.28ms
-

usedJSHeapSize

VersionAvg timevs preact-mainvs preact-localvs preact-hooks
preact-main0.95ms - 0.95ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
faster ✔
3% - 3%
0.03ms - 0.03ms
preact-local0.95ms - 0.95msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-faster ✔
3% - 3%
0.03ms - 0.03ms
preact-hooks0.98ms - 0.98msslower ❌
3% - 3%
0.03ms - 0.03ms
slower ❌
3% - 3%
0.03ms - 0.03ms
-

tachometer-reporter-action v2 for Benchmarks

Copy link

github-actions bot commented Feb 16, 2024

Size Change: +10 B (0%)

Total Size: 60.1 kB

Filename Size Change
dist/preact.js 4.55 kB +2 B (0%)
dist/preact.min.js 4.59 kB +2 B (0%)
dist/preact.min.module.js 4.58 kB +2 B (0%)
dist/preact.min.umd.js 4.61 kB +1 B
dist/preact.module.js 4.57 kB +2 B (0%)
dist/preact.umd.js 4.63 kB +1 B
ℹ️ View Unchanged
Filename Size Change
compat/dist/compat.js 4 kB 0 B
compat/dist/compat.module.js 3.92 kB 0 B
compat/dist/compat.umd.js 4.06 kB 0 B
debug/dist/debug.js 3.52 kB 0 B
debug/dist/debug.module.js 3.52 kB 0 B
debug/dist/debug.umd.js 3.6 kB 0 B
devtools/dist/devtools.js 232 B 0 B
devtools/dist/devtools.module.js 241 B 0 B
devtools/dist/devtools.umd.js 316 B 0 B
hooks/dist/hooks.js 1.55 kB 0 B
hooks/dist/hooks.module.js 1.59 kB 0 B
hooks/dist/hooks.umd.js 1.63 kB 0 B
jsx-runtime/dist/jsxRuntime.js 963 B 0 B
jsx-runtime/dist/jsxRuntime.module.js 938 B 0 B
jsx-runtime/dist/jsxRuntime.umd.js 1.04 kB 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

@JoviDeCroock JoviDeCroock changed the title Fix scenario where we would crash when replacing a matched vnode with null fix: address scenario where we would crash when replacing a matched vnode with null Feb 16, 2024
@coveralls
Copy link

coveralls commented Feb 16, 2024

Coverage Status

coverage: 99.472%. remained the same
when pulling ddc0255 on add-test-for-4274
into f808dcb on main.

Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

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

Nice one!!

@JoviDeCroock JoviDeCroock merged commit 2f44635 into main Feb 16, 2024
13 checks passed
@JoviDeCroock JoviDeCroock deleted the add-test-for-4274 branch February 16, 2024 09:22
@JoviDeCroock JoviDeCroock mentioned this pull request Feb 16, 2024
@andrewiggins
Copy link
Member

Oh, nice catch!

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.

Components keep being added when updating state 10.18.2 regression: Cannot read properties of undefined
4 participants