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 setstate order #3763

Merged
merged 2 commits into from Oct 14, 2022
Merged

fix setstate order #3763

merged 2 commits into from Oct 14, 2022

Conversation

JoviDeCroock
Copy link
Member

fixes #3762
fixes #3761

Currently we reset the array as part of the loop.... dumb from me.... 😅 secondly when we set state as part of any of the will methods, SCU or render we would skip it which was wrong.

I also found that we had the wrong order we did setState CB > CDU, react version here

@github-actions
Copy link

github-actions bot commented Oct 11, 2022

📊 Tachometer Benchmark Results

Summary

duration

  • 02_replace1k: unsure 🔍 -4% - +13% (-6.85ms - +21.86ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -5% - +3% (-2.61ms - +1.58ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -1% - +0% (-12.89ms - +6.42ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -1% - +4% (-0.15ms - +1.25ms)
    preact-local vs preact-master
  • hydrate1k: slower ❌ 0% - 4% (0.38ms - 7.08ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -2% - +5% (-0.55ms - +1.37ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 -3% - +4% (-0.09ms - +0.14ms)
    preact-local vs preact-master
  • todo: unsure 🔍 -1% - +1% (-0.53ms - +0.45ms)
    preact-local vs preact-master

usedJSHeapSize

  • 02_replace1k: unsure 🔍 -9% - +3% (-0.40ms - +0.12ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    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 🔍 -6% - +3% (-0.93ms - +0.42ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -0% - +0% (-0.01ms - +0.00ms)
    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-master159.91ms - 182.09ms-unsure 🔍
-12% - +4%
-21.86ms - +6.85ms
slower ❌
5% - 36%
10.19ms - 48.36ms
preact-local169.39ms - 187.62msunsure 🔍
-4% - +13%
-6.85ms - +21.86ms
-slower ❌
11% - 41%
18.77ms - 54.79ms
preact-hooks126.19ms - 157.26msfaster ✔
7% - 28%
10.19ms - 48.36ms
faster ✔
11% - 30%
18.77ms - 54.79ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master4.07ms - 4.48ms-unsure 🔍
-3% - +10%
-0.12ms - +0.40ms
faster ✔
14% - 26%
0.67ms - 1.42ms
preact-local3.97ms - 4.30msunsure 🔍
-9% - +3%
-0.40ms - +0.12ms
-faster ✔
17% - 28%
0.83ms - 1.54ms
preact-hooks5.01ms - 5.63msslower ❌
15% - 34%
0.67ms - 1.42ms
slower ❌
20% - 38%
0.83ms - 1.54ms
-

run-warmup-0

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.32ms - 1.47ms-unsure 🔍
-17% - +8%
-0.25ms - +0.12ms
unsure 🔍
-13% - +7%
-0.19ms - +0.10ms
preact-local1.29ms - 1.63msunsure 🔍
-9% - +18%
-0.12ms - +0.25ms
-unsure 🔍
-13% - +16%
-0.19ms - +0.23ms
preact-hooks1.31ms - 1.56msunsure 🔍
-8% - +14%
-0.10ms - +0.19ms
unsure 🔍
-16% - +13%
-0.23ms - +0.19ms
-

run-warmup-1

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master0.82ms - 1.19ms-unsure 🔍
-27% - +24%
-0.27ms - +0.24ms
faster ✔
73% - 83%
2.92ms - 4.34ms
preact-local0.84ms - 1.20msunsure 🔍
-24% - +27%
-0.24ms - +0.27ms
-faster ✔
73% - 83%
2.91ms - 4.32ms
preact-hooks3.95ms - 5.32msslower ❌
252% - 470%
2.92ms - 4.34ms
slower ❌
250% - 457%
2.91ms - 4.32ms
-

run-warmup-2

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master0.53ms - 0.64ms-unsure 🔍
-22% - +11%
-0.14ms - +0.07ms
unsure 🔍
-16% - +19%
-0.09ms - +0.11ms
preact-local0.53ms - 0.71msunsure 🔍
-13% - +24%
-0.07ms - +0.14ms
-unsure 🔍
-14% - +29%
-0.08ms - +0.16ms
preact-hooks0.49ms - 0.65msunsure 🔍
-19% - +15%
-0.11ms - +0.09ms
unsure 🔍
-26% - +12%
-0.16ms - +0.08ms
-

run-warmup-3

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master0.51ms - 0.65ms-unsure 🔍
-34% - +24%
-0.22ms - +0.15ms
unsure 🔍
-31% - +1%
-0.22ms - +0.02ms
preact-local0.44ms - 0.79msunsure 🔍
-27% - +37%
-0.15ms - +0.22ms
-unsure 🔍
-38% - +18%
-0.27ms - +0.13ms
preact-hooks0.59ms - 0.78msunsure 🔍
-4% - +39%
-0.02ms - +0.22ms
unsure 🔍
-24% - +46%
-0.13ms - +0.27ms
-

run-warmup-4

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master0.44ms - 0.59ms-unsure 🔍
-1% - +44%
-0.00ms - +0.18ms
unsure 🔍
-40% - +3%
-0.28ms - +0.04ms
preact-local0.38ms - 0.47msunsure 🔍
-33% - -2%
-0.18ms - +0.00ms
-faster ✔
16% - 49%
0.06ms - 0.35ms
preact-hooks0.49ms - 0.77msunsure 🔍
-10% - +55%
-0.04ms - +0.28ms
slower ❌
13% - 85%
0.06ms - 0.35ms
-

run-final

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master0.45ms - 0.59ms-unsure 🔍
-7% - +31%
-0.03ms - +0.14ms
unsure 🔍
-22% - +15%
-0.12ms - +0.08ms
preact-local0.41ms - 0.52msunsure 🔍
-26% - +5%
-0.14ms - +0.03ms
-unsure 🔍
-29% - +2%
-0.16ms - +0.02ms
preact-hooks0.46ms - 0.61msunsure 🔍
-16% - +23%
-0.08ms - +0.12ms
unsure 🔍
-5% - +36%
-0.02ms - +0.16ms
-
03_update10th1k_x16

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master53.92ms - 56.96ms-unsure 🔍
-3% - +5%
-1.58ms - +2.61ms
unsure 🔍
-3% - +4%
-1.77ms - +2.12ms
preact-local53.48ms - 56.36msunsure 🔍
-5% - +3%
-2.61ms - +1.58ms
-unsure 🔍
-4% - +3%
-2.23ms - +1.54ms
preact-hooks54.04ms - 56.48msunsure 🔍
-4% - +3%
-2.12ms - +1.77ms
unsure 🔍
-3% - +4%
-1.54ms - +2.23ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.78ms - 3.79ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
faster ✔
10% - 10%
0.40ms - 0.41ms
preact-local3.78ms - 3.79msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-faster ✔
10% - 10%
0.40ms - 0.41ms
preact-hooks4.19ms - 4.20msslower ❌
11% - 11%
0.40ms - 0.41ms
slower ❌
11% - 11%
0.40ms - 0.41ms
-
07_create10k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1310.47ms - 1324.43ms-unsure 🔍
-0% - +1%
-6.42ms - +12.89ms
faster ✔
1% - 3%
19.33ms - 45.35ms
preact-local1307.54ms - 1320.89msunsure 🔍
-1% - +0%
-12.89ms - +6.42ms
-faster ✔
2% - 4%
22.73ms - 48.42ms
preact-hooks1338.82ms - 1360.76msslower ❌
1% - 3%
19.33ms - 45.35ms
slower ❌
2% - 4%
22.73ms - 48.42ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master25.84ms - 25.84ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
faster ✔
9% - 9%
2.55ms - 2.55ms
preact-local25.84ms - 25.84msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-faster ✔
9% - 9%
2.55ms - 2.55ms
preact-hooks28.39ms - 28.39msslower ❌
10% - 10%
2.55ms - 2.55ms
slower ❌
10% - 10%
2.55ms - 2.55ms
-
filter_list

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master28.63ms - 29.54ms-unsure 🔍
-4% - +0%
-1.25ms - +0.15ms
faster ✔
3% - 8%
0.83ms - 2.55ms
preact-local29.10ms - 30.16msunsure 🔍
-1% - +4%
-0.15ms - +1.25ms
-faster ✔
1% - 7%
0.24ms - 2.04ms
preact-hooks30.04ms - 31.50msslower ❌
3% - 9%
0.83ms - 2.55ms
slower ❌
1% - 7%
0.24ms - 2.04ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.93ms - 1.93ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
faster ✔
11% - 11%
0.24ms - 0.24ms
preact-local1.93ms - 1.93msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-faster ✔
11% - 11%
0.24ms - 0.24ms
preact-hooks2.16ms - 2.16msslower ❌
12% - 12%
0.24ms - 0.24ms
slower ❌
12% - 12%
0.24ms - 0.24ms
-
hydrate1k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master167.57ms - 172.42ms-faster ✔
0% - 4%
0.38ms - 7.08ms
faster ✔
2% - 5%
2.82ms - 9.27ms
preact-local171.41ms - 176.04msslower ❌
0% - 4%
0.38ms - 7.08ms
-unsure 🔍
-3% - +0%
-5.46ms - +0.83ms
preact-hooks173.91ms - 178.17msslower ❌
2% - 5%
2.82ms - 9.27ms
unsure 🔍
-0% - +3%
-0.83ms - +5.46ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master14.67ms - 15.65ms-unsure 🔍
-3% - +6%
-0.42ms - +0.93ms
unsure 🔍
-4% - +5%
-0.64ms - +0.71ms
preact-local14.44ms - 15.37msunsure 🔍
-6% - +3%
-0.93ms - +0.42ms
-unsure 🔍
-6% - +3%
-0.88ms - +0.44ms
preact-hooks14.65ms - 15.59msunsure 🔍
-5% - +4%
-0.71ms - +0.64ms
unsure 🔍
-3% - +6%
-0.44ms - +0.88ms
-
many_updates

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master29.49ms - 30.82ms-unsure 🔍
-4% - +2%
-1.37ms - +0.55ms
faster ✔
5% - 10%
1.46ms - 3.37ms
preact-local29.88ms - 31.26msunsure 🔍
-2% - +5%
-0.55ms - +1.37ms
-faster ✔
3% - 9%
1.03ms - 2.98ms
preact-hooks31.88ms - 33.26msslower ❌
5% - 11%
1.46ms - 3.37ms
slower ❌
3% - 10%
1.03ms - 2.98ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master4.97ms - 4.97ms-unsure 🔍
-0% - +0%
-0.00ms - +0.01ms
faster ✔
8% - 8%
0.44ms - 0.45ms
preact-local4.96ms - 4.97msunsure 🔍
-0% - +0%
-0.01ms - +0.00ms
-faster ✔
8% - 8%
0.44ms - 0.45ms
preact-hooks5.41ms - 5.41msslower ❌
9% - 9%
0.44ms - 0.45ms
slower ❌
9% - 9%
0.44ms - 0.45ms
-
text_update

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.54ms - 3.67ms-unsure 🔍
-4% - +3%
-0.14ms - +0.09ms
faster ✔
7% - 13%
0.28ms - 0.55ms
preact-local3.53ms - 3.72msunsure 🔍
-3% - +4%
-0.09ms - +0.14ms
-faster ✔
6% - 13%
0.24ms - 0.55ms
preact-hooks3.90ms - 4.14msslower ❌
8% - 15%
0.28ms - 0.55ms
slower ❌
6% - 15%
0.24ms - 0.55ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.14ms - 1.14ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
faster ✔
1% - 1%
0.02ms - 0.02ms
preact-local1.14ms - 1.14msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-faster ✔
1% - 1%
0.02ms - 0.02ms
preact-hooks1.16ms - 1.16msslower ❌
1% - 1%
0.02ms - 0.02ms
slower ❌
1% - 1%
0.02ms - 0.02ms
-
todo

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master58.51ms - 59.16ms-unsure 🔍
-1% - +1%
-0.45ms - +0.53ms
faster ✔
3% - 4%
1.76ms - 2.64ms
preact-local58.43ms - 59.16msunsure 🔍
-1% - +1%
-0.53ms - +0.45ms
-faster ✔
3% - 4%
1.76ms - 2.71ms
preact-hooks60.74ms - 61.32msslower ❌
3% - 4%
1.76ms - 2.64ms
slower ❌
3% - 5%
1.76ms - 2.71ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.43ms - 1.43ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
2% - 3%
0.03ms - 0.04ms
preact-local1.43ms - 1.43msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
2% - 2%
0.03ms - 0.04ms
preact-hooks1.47ms - 1.47msslower ❌
2% - 3%
0.03ms - 0.04ms
slower ❌
2% - 3%
0.03ms - 0.04ms
-

tachometer-reporter-action v2 for Benchmarks

@github-actions
Copy link

github-actions bot commented Oct 11, 2022

Size Change: +130 B (0%)

Total Size: 53.1 kB

Filename Size Change
dist/preact.js 4.06 kB +22 B (0%)
dist/preact.min.js 4.08 kB +23 B (0%)
dist/preact.min.module.js 4.08 kB +22 B (0%)
dist/preact.min.umd.js 4.11 kB +22 B (0%)
dist/preact.module.js 4.07 kB +20 B (0%)
dist/preact.umd.js 4.12 kB +21 B (0%)
ℹ️ View Unchanged
Filename Size Change
compat/dist/compat.js 3.78 kB 0 B
compat/dist/compat.module.js 3.72 kB 0 B
compat/dist/compat.umd.js 3.85 kB 0 B
debug/dist/debug.js 3.01 kB 0 B
debug/dist/debug.module.js 3.01 kB 0 B
debug/dist/debug.umd.js 3.09 kB 0 B
devtools/dist/devtools.js 230 B 0 B
devtools/dist/devtools.module.js 239 B 0 B
devtools/dist/devtools.umd.js 314 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.64 kB 0 B
jsx-runtime/dist/jsxRuntime.js 358 B 0 B
jsx-runtime/dist/jsxRuntime.module.js 324 B 0 B
jsx-runtime/dist/jsxRuntime.umd.js 439 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

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.

Good catch! Just double checked with the ordering in React and they have the outer setState callback last too 🎉

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0007%) to 99.53% when pulling e911a61 on fix-set-state into e968a5a on master.

@JoviDeCroock JoviDeCroock merged commit 43204de into master Oct 14, 2022
@JoviDeCroock JoviDeCroock deleted the fix-set-state branch October 14, 2022 04:33
JoviDeCroock added a commit that referenced this pull request Oct 26, 2022
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