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

Attempt a more predictable hooks shape #4591

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JoviDeCroock
Copy link
Member

This mainly looks for performance improvements by getting a more predictable object-shape for every hook. Currently we mainly use null/undefined however an even better improvement would be to leverage the eventual state, this would warrant a more thorough overhaul though.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 suggestion.

hooks/src/index.js Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Dec 4, 2024

📊 Tachometer Benchmark Results

Summary

duration

  • create10k: unsure 🔍 -1% - +0% (-10.35ms - +1.80ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +1% (-0.03ms - +0.13ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -2% - +2% (-1.55ms - +1.17ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -2% - +4% (-0.38ms - +0.61ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -2% - +1% (-1.06ms - +0.76ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -2% - +8% (-0.04ms - +0.17ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -4% - +1% (-1.23ms - +0.19ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -4% - +1% (-1.60ms - +0.21ms)
    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.03ms - +0.01ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -2% - +5% (-0.28ms - +0.53ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-main
  • replace1k: slower ❌ 0% - 1% (0.01ms - 0.05ms)
    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 🔍 -1% - +1% (-0.02ms - +0.02ms)
    preact-local vs preact-main

Results

create10k

duration

VersionAvg timevs preact-localvs preact-main
preact-local935.91ms - 942.05ms-unsure 🔍
-1% - +0%
-10.35ms - +1.80ms
preact-main938.01ms - 948.50msunsure 🔍
-0% - +1%
-1.80ms - +10.35ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local24.85ms - 24.85ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main24.85ms - 24.85msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
filter-list

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.55ms - 16.70ms-unsure 🔍
-0% - +1%
-0.03ms - +0.13ms
preact-main16.55ms - 16.60msunsure 🔍
-1% - +0%
-0.13ms - +0.03ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.65ms - 1.66ms-unsure 🔍
-1% - +0%
-0.03ms - +0.01ms
preact-main1.65ms - 1.68msunsure 🔍
-0% - +2%
-0.01ms - +0.03ms
-
hydrate1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local74.52ms - 76.54ms-unsure 🔍
-2% - +2%
-1.55ms - +1.17ms
preact-main74.81ms - 76.64msunsure 🔍
-2% - +2%
-1.17ms - +1.55ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local11.07ms - 11.66ms-unsure 🔍
-2% - +5%
-0.28ms - +0.53ms
preact-main10.97ms - 11.51msunsure 🔍
-5% - +2%
-0.53ms - +0.28ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local15.44ms - 16.17ms-unsure 🔍
-2% - +4%
-0.38ms - +0.61ms
preact-main15.35ms - 16.03msunsure 🔍
-4% - +2%
-0.61ms - +0.38ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local4.50ms - 4.51ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
preact-main4.50ms - 4.51msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-
replace1k
  • Browser: chrome-headless
  • Sample size: 100
  • Built by: CI #4163
  • Commit: 2690098

duration

VersionAvg timevs preact-localvs preact-main
preact-local67.83ms - 68.74ms-unsure 🔍
-2% - +1%
-1.06ms - +0.76ms
preact-main67.65ms - 69.22msunsure 🔍
-1% - +2%
-0.76ms - +1.06ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.59ms - 3.62ms-slower ❌
0% - 1%
0.01ms - 0.05ms
preact-main3.56ms - 3.59msfaster ✔
0% - 1%
0.01ms - 0.05ms
-

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local31.13ms - 31.83ms-unsure 🔍
-1% - +2%
-0.44ms - +0.53ms
preact-main31.10ms - 31.77msunsure 🔍
-2% - +1%
-0.53ms - +0.44ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local36.98ms - 38.37ms-unsure 🔍
-4% - +2%
-1.52ms - +0.61ms
preact-main37.33ms - 38.93msunsure 🔍
-2% - +4%
-0.61ms - +1.52ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local29.84ms - 30.95ms-unsure 🔍
-1% - +3%
-0.43ms - +0.99ms
preact-main29.68ms - 30.56msunsure 🔍
-3% - +1%
-0.99ms - +0.43ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local22.87ms - 23.64ms-unsure 🔍
-3% - +1%
-0.63ms - +0.31ms
preact-main23.14ms - 23.69msunsure 🔍
-1% - +3%
-0.31ms - +0.63ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local21.82ms - 22.29ms-unsure 🔍
-2% - +2%
-0.49ms - +0.38ms
preact-main21.75ms - 22.47msunsure 🔍
-2% - +2%
-0.38ms - +0.49ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local20.53ms - 21.12ms-unsure 🔍
-3% - +2%
-0.65ms - +0.36ms
preact-main20.56ms - 21.38msunsure 🔍
-2% - +3%
-0.36ms - +0.65ms
-
text-update
  • Browser: chrome-headless
  • Sample size: 220
  • Built by: CI #4163
  • Commit: 2690098

duration

VersionAvg timevs preact-localvs preact-main
preact-local2.15ms - 2.30ms-unsure 🔍
-2% - +8%
-0.04ms - +0.17ms
preact-main2.09ms - 2.23msunsure 🔍
-8% - +2%
-0.17ms - +0.04ms
-

usedJSHeapSize

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

duration

VersionAvg timevs preact-localvs preact-main
preact-local33.42ms - 33.92ms-unsure 🔍
-4% - +1%
-1.23ms - +0.19ms
preact-main33.53ms - 34.85msunsure 🔍
-1% - +4%
-0.19ms - +1.23ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.22ms - 1.22ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main1.22ms - 1.22msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
update10th1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local36.66ms - 37.91ms-unsure 🔍
-4% - +1%
-1.60ms - +0.21ms
preact-main37.32ms - 38.63msunsure 🔍
-1% - +4%
-0.21ms - +1.60ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.48ms - 3.51ms-unsure 🔍
-1% - +1%
-0.02ms - +0.02ms
preact-main3.48ms - 3.51msunsure 🔍
-1% - +1%
-0.02ms - +0.02ms
-

tachometer-reporter-action v2 for CI

Copy link

github-actions bot commented Dec 4, 2024

Size Change: +96 B (+0.15%)

Total Size: 62.4 kB

Filename Size Change
hooks/dist/hooks.js 1.56 kB +34 B (+2.23%)
hooks/dist/hooks.module.js 1.59 kB +32 B (+2.05%)
hooks/dist/hooks.umd.js 1.63 kB +30 B (+1.87%)
ℹ️ 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.2 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.71 kB
dist/preact.min.js 4.73 kB
dist/preact.min.module.js 4.73 kB
dist/preact.min.umd.js 4.75 kB
dist/preact.module.js 4.73 kB
dist/preact.umd.js 4.77 kB
jsx-runtime/dist/jsxRuntime.js 973 B
jsx-runtime/dist/jsxRuntime.module.js 947 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

@coveralls
Copy link

coveralls commented Dec 4, 2024

Coverage Status

coverage: 99.617%. remained the same
when pulling 2690098 on predictable-hook-shapes
into 80d9226 on main.

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.

2 participants