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

Port skew based child diffing #4010

Merged
merged 26 commits into from
Jun 14, 2023
Merged

Port skew based child diffing #4010

merged 26 commits into from
Jun 14, 2023

Conversation

JoviDeCroock
Copy link
Member

@JoviDeCroock JoviDeCroock commented May 18, 2023

This ports the skew-based child diffing we implemented in v11 to Preact X, it seems to solve a lot of performance issues and generally improves correctness. The original PR for v11 can be found in #3388

We would be able to benefit from a lot more stuff if we could use getDomSibling everywhere like in v11 https://github.com/preactjs/preact/blob/v11/src/diff/children.js#L156

TODO:

  • golf bytes (200 --> 60 bytes)
  • check why performance goes down (potentially more calls on reorderChildren)
  • investigate perf drop-off in hydration and text-update

Fixes #3973
Fixes #2622
Fixes #2783
Fixes #2987

@github-actions
Copy link

github-actions bot commented May 18, 2023

📊 Tachometer Benchmark Results

Summary

duration

  • 02_replace1k: unsure 🔍 -4% - +1% (-5.56ms - +1.44ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -4% - +5% (-1.76ms - +1.93ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -0% - +1% (-3.26ms - +13.72ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -1% - +3% (-0.16ms - +0.75ms)
    preact-local vs preact-master
  • hydrate1k: slower ❌ 5% - 9% (6.70ms - 10.60ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -1% - +8% (-0.42ms - +2.22ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 -0% - +8% (-0.00ms - +0.27ms)
    preact-local vs preact-master
  • todo: unsure 🔍 -4% - +1% (-1.92ms - +0.44ms)
    preact-local vs preact-master

usedJSHeapSize

  • 02_replace1k: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: slower ❌ 0% - 1% (0.01ms - 0.02ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 +0% - +0% (+0.00ms - +0.01ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -1% - +3% (-0.01ms - +0.04ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -1% - +0% (-0.06ms - +0.01ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -0% - +1% (-0.01ms - +0.04ms)
    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-master122.04ms - 125.79ms-unsure 🔍
-1% - +5%
-1.44ms - +5.56ms
unsure 🔍
-0% - +3%
-0.26ms - +4.25ms
preact-local118.89ms - 124.81msunsure 🔍
-4% - +1%
-5.56ms - +1.44ms
-unsure 🔍
-3% - +3%
-3.27ms - +3.15ms
preact-hooks120.66ms - 123.17msunsure 🔍
-3% - +0%
-4.25ms - +0.26ms
unsure 🔍
-3% - +3%
-3.15ms - +3.27ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.28ms - 3.29ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
faster ✔
1% - 1%
0.02ms - 0.04ms
preact-local3.28ms - 3.29msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-faster ✔
1% - 1%
0.02ms - 0.04ms
preact-hooks3.30ms - 3.32msslower ❌
1% - 1%
0.02ms - 0.04ms
slower ❌
1% - 1%
0.02ms - 0.04ms
-

run-warmup-0

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master45.91ms - 47.69ms-unsure 🔍
-4% - +2%
-1.88ms - +0.84ms
faster ✔
1% - 6%
0.39ms - 3.07ms
preact-local46.30ms - 48.35msunsure 🔍
-2% - +4%
-0.84ms - +1.88ms
-unsure 🔍
-5% - +0%
-2.65ms - +0.22ms
preact-hooks47.53ms - 49.54msslower ❌
1% - 7%
0.39ms - 3.07ms
unsure 🔍
-1% - +6%
-0.22ms - +2.65ms
-

run-warmup-1

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master58.99ms - 61.03ms-slower ❌
7% - 13%
4.03ms - 7.10ms
slower ❌
3% - 10%
2.01ms - 5.63ms
preact-local53.31ms - 55.59msfaster ✔
7% - 12%
4.03ms - 7.10ms
-unsure 🔍
-6% - +0%
-3.62ms - +0.13ms
preact-hooks54.70ms - 57.68msfaster ✔
3% - 9%
2.01ms - 5.63ms
unsure 🔍
-0% - +7%
-0.13ms - +3.62ms
-

run-warmup-2

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master50.73ms - 54.80ms-slower ❌
10% - 22%
4.56ms - 10.00ms
slower ❌
8% - 21%
4.04ms - 9.56ms
preact-local43.68ms - 47.29msfaster ✔
9% - 19%
4.56ms - 10.00ms
-unsure 🔍
-7% - +5%
-3.08ms - +2.12ms
preact-hooks44.10ms - 47.83msfaster ✔
8% - 18%
4.04ms - 9.56ms
unsure 🔍
-5% - +7%
-2.12ms - +3.08ms
-

run-warmup-3

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master31.36ms - 33.61ms-faster ✔
8% - 17%
2.87ms - 6.33ms
faster ✔
10% - 19%
3.68ms - 7.44ms
preact-local35.77ms - 38.40msslower ❌
9% - 20%
2.87ms - 6.33ms
-unsure 🔍
-8% - +3%
-2.96ms - +1.04ms
preact-hooks36.53ms - 39.55msslower ❌
11% - 23%
3.68ms - 7.44ms
unsure 🔍
-3% - +8%
-1.04ms - +2.96ms
-

run-warmup-4

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master52.46ms - 55.10ms-slower ❌
12% - 21%
5.75ms - 9.45ms
slower ❌
18% - 26%
8.13ms - 11.40ms
preact-local44.88ms - 47.47msfaster ✔
11% - 17%
5.75ms - 9.45ms
-slower ❌
1% - 9%
0.54ms - 3.79ms
preact-hooks43.04ms - 44.98msfaster ✔
15% - 21%
8.13ms - 11.40ms
faster ✔
1% - 8%
0.54ms - 3.79ms
-

run-final

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master30.40ms - 33.76ms-unsure 🔍
-2% - +12%
-0.65ms - +3.62ms
unsure 🔍
-1% - +11%
-0.36ms - +3.30ms
preact-local29.28ms - 31.92msunsure 🔍
-11% - +2%
-3.62ms - +0.65ms
-unsure 🔍
-5% - +5%
-1.51ms - +1.49ms
preact-hooks29.89ms - 31.33msunsure 🔍
-10% - +1%
-3.30ms - +0.36ms
unsure 🔍
-5% - +5%
-1.49ms - +1.51ms
-
03_update10th1k_x16

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master38.04ms - 40.68ms-unsure 🔍
-5% - +4%
-1.93ms - +1.76ms
unsure 🔍
-7% - +2%
-2.76ms - +0.80ms
preact-local38.16ms - 40.73msunsure 🔍
-4% - +5%
-1.76ms - +1.93ms
-unsure 🔍
-7% - +2%
-2.65ms - +0.86ms
preact-hooks39.15ms - 41.53msunsure 🔍
-2% - +7%
-0.80ms - +2.76ms
unsure 🔍
-2% - +7%
-0.86ms - +2.65ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.23ms - 3.23ms-faster ✔
0% - 1%
0.01ms - 0.02ms
faster ✔
1% - 1%
0.03ms - 0.04ms
preact-local3.24ms - 3.25msslower ❌
0% - 1%
0.01ms - 0.02ms
-faster ✔
1% - 1%
0.02ms - 0.03ms
preact-hooks3.26ms - 3.27msslower ❌
1% - 1%
0.03ms - 0.04ms
slower ❌
1% - 1%
0.02ms - 0.03ms
-
07_create10k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1187.06ms - 1199.07ms-unsure 🔍
-1% - +0%
-13.72ms - +3.26ms
faster ✔
1% - 2%
7.90ms - 26.68ms
preact-local1192.29ms - 1204.31msunsure 🔍
-0% - +1%
-3.26ms - +13.72ms
-faster ✔
0% - 2%
2.66ms - 21.45ms
preact-hooks1203.14ms - 1217.58msslower ❌
1% - 2%
7.90ms - 26.68ms
slower ❌
0% - 2%
2.66ms - 21.45ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master25.31ms - 25.31ms-unsure 🔍
-0% - -0%
-0.01ms - -0.00ms
unsure 🔍
-0% - -0%
-0.02ms - -0.02ms
preact-local25.32ms - 25.32msunsure 🔍
+0% - +0%
+0.00ms - +0.01ms
-unsure 🔍
-0% - -0%
-0.02ms - -0.02ms
preact-hooks25.34ms - 25.34msunsure 🔍
+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-master25.57ms - 26.33ms-unsure 🔍
-3% - +1%
-0.75ms - +0.16ms
faster ✔
1% - 5%
0.19ms - 1.23ms
preact-local25.99ms - 26.49msunsure 🔍
-1% - +3%
-0.16ms - +0.75ms
-unsure 🔍
-3% - +0%
-0.85ms - +0.01ms
preact-hooks26.31ms - 27.01msslower ❌
1% - 5%
0.19ms - 1.23ms
unsure 🔍
-0% - +3%
-0.01ms - +0.85ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.39ms - 1.43ms-unsure 🔍
-3% - +1%
-0.04ms - +0.01ms
faster ✔
0% - 4%
0.01ms - 0.05ms
preact-local1.40ms - 1.44msunsure 🔍
-1% - +3%
-0.01ms - +0.04ms
-unsure 🔍
-3% - +1%
-0.04ms - +0.01ms
preact-hooks1.42ms - 1.46msslower ❌
0% - 4%
0.01ms - 0.05ms
unsure 🔍
-1% - +3%
-0.01ms - +0.04ms
-
hydrate1k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master120.83ms - 124.05ms-faster ✔
5% - 8%
6.70ms - 10.60ms
faster ✔
6% - 9%
8.10ms - 12.19ms
preact-local130.00ms - 132.18msslower ❌
5% - 9%
6.70ms - 10.60ms
-unsure 🔍
-2% - +0%
-3.16ms - +0.17ms
preact-hooks131.33ms - 133.84msslower ❌
7% - 10%
8.10ms - 12.19ms
unsure 🔍
-0% - +2%
-0.17ms - +3.16ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master5.92ms - 5.98ms-unsure 🔍
-0% - +1%
-0.01ms - +0.06ms
unsure 🔍
-1% - +0%
-0.07ms - +0.00ms
preact-local5.90ms - 5.95msunsure 🔍
-1% - +0%
-0.06ms - +0.01ms
-faster ✔
0% - 2%
0.03ms - 0.10ms
preact-hooks5.96ms - 6.01msunsure 🔍
-0% - +1%
-0.00ms - +0.07ms
slower ❌
0% - 2%
0.03ms - 0.10ms
-
many_updates

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master28.74ms - 30.36ms-unsure 🔍
-7% - +1%
-2.22ms - +0.42ms
unsure 🔍
-8% - +0%
-2.42ms - +0.07ms
preact-local29.41ms - 31.49msunsure 🔍
-1% - +8%
-0.42ms - +2.22ms
-unsure 🔍
-5% - +4%
-1.67ms - +1.13ms
preact-hooks29.79ms - 31.67msunsure 🔍
-0% - +8%
-0.07ms - +2.42ms
unsure 🔍
-4% - +6%
-1.13ms - +1.67ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master4.43ms - 4.47ms-unsure 🔍
-1% - +0%
-0.04ms - +0.01ms
unsure 🔍
-1% - +0%
-0.04ms - +0.00ms
preact-local4.44ms - 4.48msunsure 🔍
-0% - +1%
-0.01ms - +0.04ms
-unsure 🔍
-1% - +0%
-0.03ms - +0.02ms
preact-hooks4.45ms - 4.48msunsure 🔍
-0% - +1%
-0.00ms - +0.04ms
unsure 🔍
-0% - +1%
-0.02ms - +0.03ms
-
text_update

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.46ms - 3.62ms-unsure 🔍
-7% - -0%
-0.27ms - +0.00ms
faster ✔
6% - 13%
0.22ms - 0.53ms
preact-local3.57ms - 3.78msunsure 🔍
-0% - +8%
-0.00ms - +0.27ms
-faster ✔
2% - 10%
0.07ms - 0.41ms
preact-hooks3.78ms - 4.05msslower ❌
6% - 15%
0.22ms - 0.53ms
slower ❌
2% - 11%
0.07ms - 0.41ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master0.62ms - 0.62ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
9% - 11%
0.06ms - 0.08ms
preact-local0.62ms - 0.62msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
9% - 11%
0.06ms - 0.08ms
preact-hooks0.68ms - 0.70msslower ❌
10% - 12%
0.06ms - 0.08ms
slower ❌
10% - 12%
0.06ms - 0.08ms
-
todo

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master45.13ms - 46.57ms-unsure 🔍
-1% - +4%
-0.44ms - +1.92ms
unsure 🔍
-4% - +2%
-1.86ms - +0.77ms
preact-local44.18ms - 46.05msunsure 🔍
-4% - +1%
-1.92ms - +0.44ms
-unsure 🔍
-6% - +0%
-2.72ms - +0.16ms
preact-hooks45.30ms - 47.49msunsure 🔍
-2% - +4%
-0.77ms - +1.86ms
unsure 🔍
-0% - +6%
-0.16ms - +2.72ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master0.84ms - 0.84ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
faster ✔
3% - 3%
0.03ms - 0.03ms
preact-local0.84ms - 0.84msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-faster ✔
3% - 3%
0.02ms - 0.03ms
preact-hooks0.87ms - 0.87msslower ❌
3% - 3%
0.03ms - 0.03ms
slower ❌
3% - 3%
0.02ms - 0.03ms
-

tachometer-reporter-action v2 for Benchmarks

@github-actions
Copy link

github-actions bot commented May 18, 2023

Size Change: +427 B (0%)

Total Size: 56.9 kB

Filename Size Change
dist/preact.js 4.33 kB +74 B (1%)
dist/preact.min.js 4.36 kB +69 B (1%)
dist/preact.min.module.js 4.36 kB +70 B (1%)
dist/preact.min.umd.js 4.39 kB +71 B (1%)
dist/preact.module.js 4.36 kB +73 B (1%)
dist/preact.umd.js 4.4 kB +70 B (1%)
ℹ️ View Unchanged
Filename Size Change
compat/dist/compat.js 3.92 kB 0 B
compat/dist/compat.module.js 3.84 kB 0 B
compat/dist/compat.umd.js 3.98 kB 0 B
debug/dist/debug.js 3.64 kB 0 B
debug/dist/debug.module.js 3.62 kB 0 B
debug/dist/debug.umd.js 3.71 kB 0 B
devtools/dist/devtools.js 232 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 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

@coveralls
Copy link

coveralls commented May 18, 2023

Coverage Status

coverage: 99.706% (-0.002%) from 99.708% when pulling 4fe8732 on try-skew-based into 841ef82 on master.

@marvinhagemeister
Copy link
Member

Approving because bench results seem to be an issue with our setup

@JoviDeCroock JoviDeCroock merged commit d887539 into master Jun 14, 2023
@JoviDeCroock JoviDeCroock deleted the try-skew-based branch June 14, 2023 09:14
@JoviDeCroock JoviDeCroock mentioned this pull request Jun 24, 2023
1 task
@JoviDeCroock JoviDeCroock mentioned this pull request Jul 8, 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
3 participants