preactjs / preact

⚛ī¸ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.
https://preactjs.com
MIT License
36.35k stars 1.93k forks source link

fix(hooks): memo being too lazy with repeated renders #4426

Closed JoviDeCroock closed 1 week ago

JoviDeCroock commented 1 week ago

This now equalises our behavior with React, we need to ensure that when we repeat a render we throwaway queued effects, this is done in _render. We however want to maintain achieved hook-states for i.e. useMemo as they are synchronous anyway, React seems to achieve this by disposing the WIP but retaining hooks-state. This PR makes us behave similarly.

Fixes #4422

github-actions[bot] commented 1 week ago

📊 Tachometer Benchmark Results

Summary

duration

  • create10k: unsure 🔍 -1% - +0% (-7.46ms - +2.92ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +1% (-0.08ms - +0.17ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -4% - +5% (-2.58ms - +3.34ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -1% - +3% (-0.08ms - +0.54ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -3% - +2% (-2.01ms - +1.70ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -5% - +4% (-0.09ms - +0.08ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -0% - +1% (-0.02ms - +0.36ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -3% - +1% (-1.10ms - +0.26ms)
    preact-local vs preact-main

usedJSHeapSize

  • create10k: unsure 🔍 -0% - +0% (-0.02ms - +0.00ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -1% - +2% (-0.17ms - +0.25ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -1% - +0% (-0.03ms - +0.01ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -0% - +1% (-0.00ms - +0.01ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 +0% - +0% (+0.00ms - +0.00ms)
    preact-local vs preact-main

Results

create10k
  • Browser: chrome-headless
  • Sample size: 50
  • Built by: Benchmarks #1555
  • Commit: 1209527

duration

VersionAvg timevs preact-localvs preact-main
preact-local859.96ms - 865.01ms-unsure 🔍
-1% - +0%
-7.46ms - +2.92ms
preact-main860.23ms - 869.29msunsure 🔍
-0% - +1%
-2.92ms - +7.46ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local25.15ms - 25.15ms-unsure 🔍
-0% - +0%
-0.02ms - +0.00ms
preact-main25.15ms - 25.17msunsure 🔍
-0% - +0%
-0.00ms - +0.02ms
-
filter-list
  • Browser: chrome-headless
  • Sample size: 50
  • Built by: Benchmarks #1555
  • Commit: 1209527

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.67ms - 16.87ms-unsure 🔍
-0% - +1%
-0.08ms - +0.17ms
preact-main16.66ms - 16.79msunsure 🔍
-1% - +0%
-0.17ms - +0.08ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.69ms - 1.69ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main1.69ms - 1.69msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
hydrate1k
  • Browser: chrome-headless
  • Sample size: 50
  • Built by: Benchmarks #1555
  • Commit: 1209527

duration

VersionAvg timevs preact-localvs preact-main
preact-local68.81ms - 73.16ms-unsure 🔍
-4% - +5%
-2.58ms - +3.34ms
preact-main68.60ms - 72.62msunsure 🔍
-5% - +4%
-3.34ms - +2.58ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local13.14ms - 13.47ms-unsure 🔍
-1% - +2%
-0.17ms - +0.25ms
preact-main13.13ms - 13.40msunsure 🔍
-2% - +1%
-0.25ms - +0.17ms
-
many-updates
  • Browser: chrome-headless
  • Sample size: 50
  • Built by: Benchmarks #1555
  • Commit: 1209527

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.48ms - 17.08ms-unsure 🔍
-1% - +3%
-0.08ms - +0.54ms
preact-main16.47ms - 16.64msunsure 🔍
-3% - +0%
-0.54ms - +0.08ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local4.61ms - 4.61ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main4.61ms - 4.61msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
replace1k
  • Browser: chrome-headless
  • Sample size: 100
  • Built by: Benchmarks #1555
  • Commit: 1209527

duration

VersionAvg timevs preact-localvs preact-main
preact-local76.03ms - 78.63ms-unsure 🔍
-3% - +2%
-2.01ms - +1.70ms
preact-main76.17ms - 78.81msunsure 🔍
-2% - +3%
-1.70ms - +2.01ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.51ms - 3.54ms-unsure 🔍
-1% - +0%
-0.03ms - +0.01ms
preact-main3.52ms - 3.55msunsure 🔍
-0% - +1%
-0.01ms - +0.03ms
-

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local29.30ms - 29.88ms-unsure 🔍
-0% - +3%
-0.05ms - +0.79ms
preact-main28.92ms - 29.52msunsure 🔍
-3% - +0%
-0.79ms - +0.05ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local34.93ms - 36.83ms-unsure 🔍
-1% - +7%
-0.37ms - +2.33ms
preact-main33.94ms - 35.86msunsure 🔍
-6% - +1%
-2.33ms - +0.37ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local25.63ms - 26.23ms-unsure 🔍
-1% - +2%
-0.28ms - +0.48ms
preact-main25.60ms - 26.07msunsure 🔍
-2% - +1%
-0.48ms - +0.28ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local30.01ms - 31.58ms-unsure 🔍
-5% - +2%
-1.68ms - +0.49ms
preact-main30.65ms - 32.14msunsure 🔍
-2% - +5%
-0.49ms - +1.68ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local23.04ms - 24.79ms-unsure 🔍
-3% - +7%
-0.73ms - +1.72ms
preact-main22.56ms - 24.27msunsure 🔍
-7% - +3%
-1.72ms - +0.73ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local23.59ms - 24.60ms-unsure 🔍
-4% - +2%
-0.88ms - +0.59ms
preact-main23.71ms - 24.77msunsure 🔍
-2% - +4%
-0.59ms - +0.88ms
-
text-update
  • Browser: chrome-headless
  • Sample size: 120
  • Built by: Benchmarks #1555
  • Commit: 1209527

duration

VersionAvg timevs preact-localvs preact-main
preact-local1.98ms - 2.12ms-unsure 🔍
-5% - +4%
-0.09ms - +0.08ms
preact-main2.00ms - 2.11msunsure 🔍
-4% - +5%
-0.08ms - +0.09ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local0.98ms - 0.99ms-unsure 🔍
-0% - +1%
-0.00ms - +0.01ms
preact-main0.98ms - 0.98msunsure 🔍
-1% - +0%
-0.01ms - +0.00ms
-
todo
  • Browser: chrome-headless
  • Sample size: 50
  • Built by: Benchmarks #1555
  • Commit: 1209527

duration

VersionAvg timevs preact-localvs preact-main
preact-local27.29ms - 27.58ms-unsure 🔍
-0% - +1%
-0.02ms - +0.36ms
preact-main27.14ms - 27.39msunsure 🔍
-1% - +0%
-0.36ms - +0.02ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.25ms - 1.25ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main1.25ms - 1.25msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
update10th1k
  • Browser: chrome-headless
  • Sample size: 50
  • Built by: Benchmarks #1555
  • Commit: 1209527

duration

VersionAvg timevs preact-localvs preact-main
preact-local35.17ms - 35.89ms-unsure 🔍
-3% - +1%
-1.10ms - +0.26ms
preact-main35.38ms - 36.53msunsure 🔍
-1% - +3%
-0.26ms - +1.10ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.55ms - 3.55ms-unsure 🔍
+0% - +0%
+0.00ms - +0.00ms
preact-main3.55ms - 3.55msunsure 🔍
-0% - -0%
-0.00ms - -0.00ms
-

tachometer-reporter-action v2 for Benchmarks

github-actions[bot] commented 1 week ago

Size Change: -88 B (-0.14%)

Total Size: 61.7 kB

Filename Size Change
hooks/dist/hooks.js 1.53 kB -28 B (-1.8%)
hooks/dist/hooks.module.js 1.56 kB -30 B (-1.88%)
hooks/dist/hooks.umd.js 1.6 kB -30 B (-1.84%)
ℹī¸ View Unchanged | Filename | Size | | :--- | :---: | | `compat/dist/compat.js` | 4.1 kB | | `compat/dist/compat.module.js` | 4.03 kB | | `compat/dist/compat.umd.js` | 4.17 kB | | `debug/dist/debug.js` | 3.7 kB | | `debug/dist/debug.module.js` | 3.71 kB | | `debug/dist/debug.umd.js` | 3.78 kB | | `devtools/dist/devtools.js` | 259 B | | `devtools/dist/devtools.module.js` | 273 B | | `devtools/dist/devtools.umd.js` | 345 B | | `dist/preact.js` | 4.67 kB | | `dist/preact.min.js` | 4.7 kB | | `dist/preact.min.module.js` | 4.7 kB | | `dist/preact.min.umd.js` | 4.73 kB | | `dist/preact.module.js` | 4.7 kB | | `dist/preact.umd.js` | 4.75 kB | | `jsx-runtime/dist/jsxRuntime.js` | 981 B | | `jsx-runtime/dist/jsxRuntime.module.js` | 956 B | | `jsx-runtime/dist/jsxRuntime.umd.js` | 1.06 kB | | `test-utils/dist/testUtils.js` | 451 B | | `test-utils/dist/testUtils.module.js` | 456 B | | `test-utils/dist/testUtils.umd.js` | 536 B |

compressed-size-action

coveralls commented 1 week ago

Coverage Status

coverage: 99.611%. remained the same when pulling 00682605f03f073cabe4354dce49a5933a6cd602 on memo-fix into eb3767723d43e8a38453efc28d187810edfa4231 on main.

coveralls commented 1 week ago

Coverage Status

coverage: 99.611%. remained the same when pulling d0daefa71a786d97aab41f99e90db296a6b80154 on memo-fix into eb3767723d43e8a38453efc28d187810edfa4231 on main.

coveralls commented 1 week ago

Coverage Status

coverage: 99.611%. remained the same when pulling 00682605f03f073cabe4354dce49a5933a6cd602 on memo-fix into eb3767723d43e8a38453efc28d187810edfa4231 on main.

coveralls commented 1 week ago

Coverage Status

coverage: 99.611%. remained the same when pulling 00682605f03f073cabe4354dce49a5933a6cd602 on memo-fix into eb3767723d43e8a38453efc28d187810edfa4231 on main.

coveralls commented 1 week ago

Coverage Status

coverage: 99.611%. remained the same when pulling 1209527c016b2472910b8273fa5d3b4ff4f1575d on memo-fix into eb3767723d43e8a38453efc28d187810edfa4231 on main.

coveralls commented 1 week ago

Coverage Status

coverage: 99.611%. remained the same when pulling 1209527c016b2472910b8273fa5d3b4ff4f1575d on memo-fix into eb3767723d43e8a38453efc28d187810edfa4231 on main.

coveralls commented 1 week ago

Coverage Status

coverage: 99.611%. remained the same when pulling 1209527c016b2472910b8273fa5d3b4ff4f1575d on memo-fix into eb3767723d43e8a38453efc28d187810edfa4231 on main.

coveralls commented 1 week ago

Coverage Status

coverage: 99.611%. remained the same when pulling 1209527c016b2472910b8273fa5d3b4ff4f1575d on memo-fix into eb3767723d43e8a38453efc28d187810edfa4231 on main.