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

Ensure state updates work in signals #4560

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

JoviDeCroock
Copy link
Member

I encountered a case where a component with both a state-hook and a signal would update both at once, the state-hook would settle to the same value meaning that the signal state update would get fully ignored.

This makes sense as we don't account for multiple sources of state in our hooks implementation, with the new implementation when we'd bail before we now check against a possibly existing scu implementation first.

Copy link

github-actions bot commented Nov 21, 2024

📊 Tachometer Benchmark Results

Summary

duration

  • create10k: unsure 🔍 -0% - +1% (-2.70ms - +7.30ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +1% (-0.07ms - +0.17ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -1% - +1% (-0.89ms - +0.73ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -2% - +2% (-0.41ms - +0.39ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -0% - +2% (-0.23ms - +1.55ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -1% - +8% (-0.01ms - +0.16ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -0% - +2% (-0.15ms - +0.66ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -4% - +2% (-1.26ms - +0.57ms)
    preact-local vs preact-main

usedJSHeapSize

  • create10k: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -1% - +0% (-0.02ms - +0.01ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -3% - +6% (-0.34ms - +0.82ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -1% - +0% (-0.02ms - +0.02ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -1% - +0% (-0.01ms - +0.00ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -1% - +0% (-0.01ms - +0.00ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -1% - +0% (-0.04ms - +0.00ms)
    preact-local vs preact-main

Results

create10k

duration

VersionAvg timevs preact-localvs preact-main
preact-local944.39ms - 952.68ms-unsure 🔍
-0% - +1%
-2.70ms - +7.30ms
preact-main943.45ms - 949.02msunsure 🔍
-1% - +0%
-7.30ms - +2.70ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local25.29ms - 25.29ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main25.29ms - 25.29msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
filter-list

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.52ms - 16.76ms-unsure 🔍
-0% - +1%
-0.07ms - +0.17ms
preact-main16.58ms - 16.61msunsure 🔍
-1% - +0%
-0.17ms - +0.07ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.66ms - 1.68ms-unsure 🔍
-1% - +0%
-0.02ms - +0.01ms
preact-main1.66ms - 1.69msunsure 🔍
-0% - +1%
-0.01ms - +0.02ms
-
hydrate1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local73.08ms - 74.27ms-unsure 🔍
-1% - +1%
-0.89ms - +0.73ms
preact-main73.20ms - 74.31msunsure 🔍
-1% - +1%
-0.73ms - +0.89ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local12.82ms - 13.59ms-unsure 🔍
-3% - +6%
-0.34ms - +0.82ms
preact-main12.53ms - 13.40msunsure 🔍
-6% - +3%
-0.82ms - +0.34ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.20ms - 16.81ms-unsure 🔍
-2% - +2%
-0.41ms - +0.39ms
preact-main16.25ms - 16.78msunsure 🔍
-2% - +2%
-0.39ms - +0.41ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local4.58ms - 4.59ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
preact-main4.58ms - 4.59msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-
replace1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local73.26ms - 74.57ms-unsure 🔍
-0% - +2%
-0.23ms - +1.55ms
preact-main72.65ms - 73.86msunsure 🔍
-2% - +0%
-1.55ms - +0.23ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.60ms - 3.63ms-unsure 🔍
-1% - +0%
-0.02ms - +0.02ms
preact-main3.61ms - 3.64msunsure 🔍
-0% - +1%
-0.02ms - +0.02ms
-

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local31.59ms - 32.28ms-unsure 🔍
-2% - +1%
-0.74ms - +0.27ms
preact-main31.80ms - 32.54msunsure 🔍
-1% - +2%
-0.27ms - +0.74ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local37.28ms - 38.71ms-unsure 🔍
-2% - +3%
-0.91ms - +1.02ms
preact-main37.29ms - 38.59msunsure 🔍
-3% - +2%
-1.02ms - +0.91ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local32.05ms - 33.05ms-unsure 🔍
-3% - +2%
-1.06ms - +0.50ms
preact-main32.23ms - 33.43msunsure 🔍
-2% - +3%
-0.50ms - +1.06ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local24.21ms - 24.59ms-unsure 🔍
-2% - +1%
-0.58ms - +0.13ms
preact-main24.32ms - 24.92msunsure 🔍
-1% - +2%
-0.13ms - +0.58ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local23.48ms - 23.82ms-unsure 🔍
-0% - +1%
-0.07ms - +0.35ms
preact-main23.40ms - 23.62msunsure 🔍
-1% - +0%
-0.35ms - +0.07ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local21.48ms - 22.11ms-unsure 🔍
-1% - +3%
-0.17ms - +0.65ms
preact-main21.30ms - 21.82msunsure 🔍
-3% - +1%
-0.65ms - +0.17ms
-
text-update
  • Browser: chrome-headless
  • Sample size: 220
  • Built by: CI #4056
  • Commit: 8c15092

duration

VersionAvg timevs preact-localvs preact-main
preact-local2.17ms - 2.30ms-unsure 🔍
-1% - +8%
-0.01ms - +0.16ms
preact-main2.10ms - 2.22msunsure 🔍
-7% - +1%
-0.16ms - +0.01ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.10ms - 1.11ms-unsure 🔍
-1% - +0%
-0.01ms - +0.00ms
preact-main1.11ms - 1.11msunsure 🔍
-0% - +1%
-0.00ms - +0.01ms
-
todo

duration

VersionAvg timevs preact-localvs preact-main
preact-local33.68ms - 34.46ms-unsure 🔍
-0% - +2%
-0.15ms - +0.66ms
preact-main33.70ms - 33.94msunsure 🔍
-2% - +0%
-0.66ms - +0.15ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.23ms - 1.23ms-unsure 🔍
-1% - +0%
-0.01ms - +0.00ms
preact-main1.22ms - 1.23msunsure 🔍
-0% - +1%
-0.00ms - +0.01ms
-
update10th1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local33.36ms - 34.63ms-unsure 🔍
-4% - +2%
-1.26ms - +0.57ms
preact-main33.68ms - 35.00msunsure 🔍
-2% - +4%
-0.57ms - +1.26ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.52ms - 3.54ms-unsure 🔍
-1% - +0%
-0.04ms - +0.00ms
preact-main3.53ms - 3.57msunsure 🔍
-0% - +1%
-0.00ms - +0.04ms
-

tachometer-reporter-action v2 for CI

@JoviDeCroock JoviDeCroock force-pushed the ensure-state-update-works-in-signals branch from b8deb47 to ed333b3 Compare November 21, 2024 07:40
Copy link

github-actions bot commented Nov 21, 2024

Size Change: -13 B (-0.02%)

Total Size: 62.3 kB

Filename Size Change
hooks/dist/hooks.js 1.52 kB -5 B (-0.33%)
hooks/dist/hooks.module.js 1.56 kB -5 B (-0.32%)
hooks/dist/hooks.umd.js 1.6 kB -3 B (-0.19%)
ℹ️ View Unchanged
Filename Size
compat/dist/compat.js 4.13 kB
compat/dist/compat.module.js 4.06 kB
compat/dist/compat.umd.js 4.19 kB
debug/dist/debug.js 3.82 kB
debug/dist/debug.module.js 3.83 kB
debug/dist/debug.umd.js 3.9 kB
devtools/dist/devtools.js 260 B
devtools/dist/devtools.module.js 274 B
devtools/dist/devtools.umd.js 346 B
dist/preact.js 4.69 kB
dist/preact.min.js 4.71 kB
dist/preact.min.module.js 4.72 kB
dist/preact.min.umd.js 4.74 kB
dist/preact.module.js 4.71 kB
dist/preact.umd.js 4.76 kB
jsx-runtime/dist/jsxRuntime.js 976 B
jsx-runtime/dist/jsxRuntime.module.js 949 B
jsx-runtime/dist/jsxRuntime.umd.js 1.05 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

@JoviDeCroock JoviDeCroock force-pushed the ensure-state-update-works-in-signals branch from ed333b3 to 8c15092 Compare November 21, 2024 07:47
@coveralls
Copy link

Coverage Status

coverage: 99.486%. remained the same
when pulling 8c15092 on ensure-state-update-works-in-signals
into 68ada1a on main.

Copy link
Member

@rschristian rschristian left a comment

Choose a reason for hiding this comment

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

Bug fix AND byte reduction? You're spoiling us :)

@JoviDeCroock JoviDeCroock merged commit 0fc547c into main Nov 21, 2024
13 checks passed
@JoviDeCroock JoviDeCroock deleted the ensure-state-update-works-in-signals branch November 21, 2024 08:37
@JoviDeCroock JoviDeCroock mentioned this pull request Nov 21, 2024
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.

4 participants