preact
preact copied to clipboard
major(core): forward ref by default
This removes the ability to get a component instance assigned to the ref, instead we will preserve ref
on props for functional components and assign for normal DOM nodes. In the start I wanted to preserve props.ref
entirely but that would make us access props.ref
quite a lot which would be megamorphic access as well as need a new condition during element diffing.
I left the base
tests untouched as we are removing component.base
anyway in #4356. During this implementation I realised that if we're able to derive that a VNode comes from a JSX transform that we could stop cloning in compat VNode props handling which would safe a lot of memory.
📊 Tachometer Benchmark Results
Summary
duration
- create10k: unsure 🔍 -1% - +3% (-7.52ms - +25.14ms)
preact-local vs preact-main - filter-list: unsure 🔍 -1% - +1% (-0.23ms - +0.12ms)
preact-local vs preact-main - hydrate1k: unsure 🔍 -2% - +2% (-1.34ms - +1.51ms)
preact-local vs preact-main - many-updates: unsure 🔍 -1% - +5% (-0.18ms - +0.84ms)
preact-local vs preact-main - replace1k: unsure 🔍 -2% - +1% (-1.40ms - +0.43ms)
preact-local vs preact-main - text-update: unsure 🔍 -6% - +0% (-0.11ms - +0.00ms)
preact-local vs preact-main - todo: unsure 🔍 -1% - +1% (-0.24ms - +0.28ms)
preact-local vs preact-main - update10th1k: unsure 🔍 -1% - +2% (-0.48ms - +0.68ms)
preact-local vs preact-main
usedJSHeapSize
- create10k: unsure 🔍 +0% - +0% (+0.00ms - +0.00ms)
preact-local vs preact-main - filter-list: unsure 🔍 +0% - +0% (+0.00ms - +0.01ms)
preact-local vs preact-main - hydrate1k: unsure 🔍 -2% - +3% (-0.27ms - +0.48ms)
preact-local vs preact-main - many-updates: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
preact-local vs preact-main - replace1k: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
preact-local vs preact-main - text-update: unsure 🔍 -6% - +1% (-0.07ms - +0.02ms)
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 #1449
-
Commit: d47b6b3
duration
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 903.07ms - 932.11ms | - | unsure 🔍 -1% - +3% -7.52ms - +25.14ms |
preact-main | 901.30ms - 916.25ms | unsure 🔍 -3% - +1% -25.14ms - +7.52ms | - |
usedJSHeapSize
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 26.75ms - 26.75ms | - | unsure 🔍 +0% - +0% +0.00ms - +0.00ms |
preact-main | 26.75ms - 26.75ms | unsure 🔍 -0% - -0% -0.00ms - -0.00ms | - |
filter-list
- Browser: chrome-headless
- Sample size: 50
- Built by: Benchmarks #1449
-
Commit: d47b6b3
duration
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 16.65ms - 16.82ms | - | unsure 🔍 -1% - +1% -0.23ms - +0.12ms |
preact-main | 16.64ms - 16.94ms | unsure 🔍 -1% - +1% -0.12ms - +0.23ms | - |
usedJSHeapSize
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 1.75ms - 1.76ms | - | unsure 🔍 +0% - +0% +0.00ms - +0.01ms |
preact-main | 1.75ms - 1.75ms | unsure 🔍 -0% - -0% -0.01ms - -0.00ms | - |
hydrate1k
- Browser: chrome-headless
- Sample size: 50
- Built by: Benchmarks #1449
-
Commit: d47b6b3
duration
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 76.18ms - 78.01ms | - | unsure 🔍 -2% - +2% -1.34ms - +1.51ms |
preact-main | 75.92ms - 78.10ms | unsure 🔍 -2% - +2% -1.51ms - +1.34ms | - |
usedJSHeapSize
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 14.17ms - 14.73ms | - | unsure 🔍 -2% - +3% -0.27ms - +0.48ms |
preact-main | 14.10ms - 14.60ms | unsure 🔍 -3% - +2% -0.48ms - +0.27ms | - |
many-updates
- Browser: chrome-headless
- Sample size: 90
- Built by: Benchmarks #1449
-
Commit: d47b6b3
duration
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 17.69ms - 18.38ms | - | unsure 🔍 -1% - +5% -0.18ms - +0.84ms |
preact-main | 17.33ms - 18.08ms | unsure 🔍 -5% - +1% -0.84ms - +0.18ms | - |
usedJSHeapSize
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 4.86ms - 4.86ms | - | unsure 🔍 -0% - +0% -0.00ms - +0.00ms |
preact-main | 4.86ms - 4.86ms | unsure 🔍 -0% - +0% -0.00ms - +0.00ms | - |
replace1k
- Browser: chrome-headless
- Sample size: 100
- Built by: Benchmarks #1449
-
Commit: d47b6b3
duration
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 63.40ms - 64.54ms | - | unsure 🔍 -2% - +1% -1.40ms - +0.43ms |
preact-main | 63.74ms - 65.17ms | unsure 🔍 -1% - +2% -0.43ms - +1.40ms | - |
usedJSHeapSize
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 3.64ms - 3.66ms | - | unsure 🔍 -0% - +0% -0.01ms - +0.01ms |
preact-main | 3.64ms - 3.66ms | unsure 🔍 -0% - +0% -0.01ms - +0.01ms | - |
run-warmup-0
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 26.57ms - 27.29ms | - | unsure 🔍 -2% - +1% -0.64ms - +0.38ms |
preact-main | 26.70ms - 27.42ms | unsure 🔍 -1% - +2% -0.38ms - +0.64ms | - |
run-warmup-1
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 33.38ms - 35.17ms | - | unsure 🔍 -5% - +2% -1.64ms - +0.85ms |
preact-main | 33.80ms - 35.54ms | unsure 🔍 -3% - +5% -0.85ms - +1.64ms | - |
run-warmup-2
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 23.68ms - 24.21ms | - | unsure 🔍 -2% - +2% -0.54ms - +0.40ms |
preact-main | 23.63ms - 24.41ms | unsure 🔍 -2% - +2% -0.40ms - +0.54ms | - |
run-warmup-3
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 22.44ms - 23.33ms | - | unsure 🔍 -0% - +6% -0.01ms - +1.26ms |
preact-main | 21.80ms - 22.72ms | unsure 🔍 -5% - +0% -1.26ms - +0.01ms | - |
run-warmup-4
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 27.99ms - 29.33ms | - | unsure 🔍 -5% - +2% -1.56ms - +0.53ms |
preact-main | 28.37ms - 29.97ms | unsure 🔍 -2% - +5% -0.53ms - +1.56ms | - |
run-final
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 21.64ms - 22.50ms | - | unsure 🔍 -3% - +3% -0.76ms - +0.56ms |
preact-main | 21.67ms - 22.67ms | unsure 🔍 -3% - +3% -0.56ms - +0.76ms | - |
text-update
- Browser: chrome-headless
- Sample size: 320
- Built by: Benchmarks #1449
-
Commit: d47b6b3
duration
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 1.69ms - 1.76ms | - | unsure 🔍 -6% - +0% -0.11ms - +0.00ms |
preact-main | 1.74ms - 1.82ms | unsure 🔍 -0% - +6% -0.00ms - +0.11ms | - |
usedJSHeapSize
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 1.16ms - 1.23ms | - | unsure 🔍 -6% - +1% -0.07ms - +0.02ms |
preact-main | 1.19ms - 1.26ms | unsure 🔍 -2% - +6% -0.02ms - +0.07ms | - |
todo
- Browser: chrome-headless
- Sample size: 50
- Built by: Benchmarks #1449
-
Commit: d47b6b3
duration
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 27.64ms - 27.99ms | - | unsure 🔍 -1% - +1% -0.24ms - +0.28ms |
preact-main | 27.61ms - 27.98ms | unsure 🔍 -1% - +1% -0.28ms - +0.24ms | - |
usedJSHeapSize
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 1.25ms - 1.25ms | - | unsure 🔍 +0% - +0% +0.00ms - +0.00ms |
preact-main | 1.25ms - 1.25ms | unsure 🔍 -0% - -0% -0.00ms - -0.00ms | - |
update10th1k
- Browser: chrome-headless
- Sample size: 50
- Built by: Benchmarks #1449
-
Commit: d47b6b3
duration
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 32.16ms - 33.02ms | - | unsure 🔍 -1% - +2% -0.48ms - +0.68ms |
preact-main | 32.10ms - 32.88ms | unsure 🔍 -2% - +1% -0.68ms - +0.48ms | - |
usedJSHeapSize
Version | Avg time | vs preact-local | vs preact-main |
---|---|---|---|
preact-local | 3.70ms - 3.70ms | - | unsure 🔍 +0% - +0% +0.00ms - +0.00ms |
preact-main | 3.69ms - 3.69ms | unsure 🔍 -0% - -0% -0.00ms - -0.00ms | - |
Size Change: -22 B (0%)
Total Size: 61 kB
Filename | Size | Change | |
---|---|---|---|
compat/dist/compat.js |
4.04 kB | -49 B (1%) | |
compat/dist/compat.module.js |
3.97 kB | -45 B (1%) | |
compat/dist/compat.umd.js |
4.1 kB | -45 B (1%) | |
debug/dist/debug.js |
3.63 kB | +4 B (0%) | |
debug/dist/debug.module.js |
3.63 kB | +3 B (0%) | |
debug/dist/debug.umd.js |
3.72 kB | +11 B (0%) | |
dist/preact.js |
4.62 kB | +12 B (0%) | |
dist/preact.min.js |
4.66 kB | +14 B (0%) | |
dist/preact.min.module.js |
4.65 kB | +11 B (0%) | |
dist/preact.min.umd.js |
4.68 kB | +14 B (0%) | |
dist/preact.module.js |
4.63 kB | +14 B (0%) | |
dist/preact.umd.js |
4.69 kB | +10 B (0%) | |
jsx-runtime/dist/jsxRuntime.js |
983 B | +7 B (0%) | |
jsx-runtime/dist/jsxRuntime.module.js |
959 B | +10 B (1%) | |
jsx-runtime/dist/jsxRuntime.umd.js |
1.06 kB | +7 B (0%) |
ℹ️ View Unchanged
Filename | Size | Change | |
---|---|---|---|
devtools/dist/devtools.js |
231 B | 0 B | |
devtools/dist/devtools.module.js |
240 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.63 kB | 0 B | |
test-utils/dist/testUtils.js |
453 B | 0 B | |
test-utils/dist/testUtils.module.js |
454 B | 0 B | |
test-utils/dist/testUtils.umd.js |
536 B | 0 B |