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

Add deeper controlled input support in compat #3926

Merged
merged 6 commits into from
Apr 6, 2023

Conversation

andrewiggins
Copy link
Member

This PR resurrects the code from #3584 but only as a compat feature. It does not address or fix the selection issue mentioned in that PR or in Jovi's blog on controlled inputs. However I think this is fine since React has the same cursor jumping issue (example) and so I'd say is acceptable for compat. I wouldn't want this in core anyway as cursor jumping or blocking user input without feedback is confusing.

To accomplish this I've added an _evented option hook that runs after we've run event handlers.

@github-actions
Copy link

github-actions bot commented Mar 6, 2023

📊 Tachometer Benchmark Results

Summary

duration

  • 02_replace1k: unsure 🔍 -2% - +3% (-2.79ms - +3.56ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -4% - +4% (-1.77ms - +1.69ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -0% - +1% (-3.96ms - +11.89ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -1% - +3% (-0.23ms - +0.70ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -1% - +3% (-1.45ms - +2.92ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -6% - +1% (-2.02ms - +0.41ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 -2% - +1% (-0.05ms - +0.04ms)
    preact-local vs preact-master
  • todo: unsure 🔍 -0% - +1% (-0.19ms - +0.75ms)
    preact-local vs preact-master

usedJSHeapSize

  • 02_replace1k: unsure 🔍 -6% - +5% (-0.21ms - +0.19ms)
    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.02ms - +0.02ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -3% - +6% (-0.31ms - +0.78ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master
  • todo: faster ✔ 0% - 1% (0.00ms - 0.01ms)
    preact-local vs preact-master

Results

02_replace1k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master116.06ms - 120.77ms-unsure 🔍
-3% - +2%
-3.56ms - +2.79ms
unsure 🔍
-5% - +1%
-5.84ms - +1.18ms
preact-local116.68ms - 120.93msunsure 🔍
-2% - +3%
-2.79ms - +3.56ms
-unsure 🔍
-4% - +1%
-5.31ms - +1.42ms
preact-hooks118.14ms - 123.35msunsure 🔍
-1% - +5%
-1.18ms - +5.84ms
unsure 🔍
-1% - +4%
-1.42ms - +5.31ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.40ms - 3.68ms-unsure 🔍
-5% - +6%
-0.19ms - +0.21ms
unsure 🔍
-2% - +6%
-0.08ms - +0.20ms
preact-local3.39ms - 3.67msunsure 🔍
-6% - +5%
-0.21ms - +0.19ms
-unsure 🔍
-3% - +5%
-0.09ms - +0.19ms
preact-hooks3.46ms - 3.50msunsure 🔍
-6% - +2%
-0.20ms - +0.08ms
unsure 🔍
-5% - +3%
-0.19ms - +0.09ms
-

run-warmup-0

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master43.80ms - 45.95ms-unsure 🔍
-4% - +2%
-1.93ms - +1.04ms
faster ✔
2% - 9%
1.12ms - 4.27ms
preact-local44.29ms - 46.34msunsure 🔍
-2% - +4%
-1.04ms - +1.93ms
-faster ✔
2% - 8%
0.71ms - 3.80ms
preact-hooks46.42ms - 48.72msslower ❌
2% - 10%
1.12ms - 4.27ms
slower ❌
1% - 8%
0.71ms - 3.80ms
-

run-warmup-1

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master61.01ms - 64.09ms-unsure 🔍
-4% - +4%
-2.20ms - +2.31ms
unsure 🔍
-4% - +2%
-2.58ms - +1.46ms
preact-local60.84ms - 64.15msunsure 🔍
-4% - +4%
-2.31ms - +2.20ms
-unsure 🔍
-4% - +2%
-2.72ms - +1.49ms
preact-hooks61.80ms - 64.42msunsure 🔍
-2% - +4%
-1.46ms - +2.58ms
unsure 🔍
-2% - +4%
-1.49ms - +2.72ms
-

run-warmup-2

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master40.69ms - 44.13ms-unsure 🔍
-11% - +3%
-4.82ms - +1.26ms
faster ✔
2% - 15%
0.86ms - 7.17ms
preact-local41.69ms - 46.69msunsure 🔍
-3% - +11%
-1.26ms - +4.82ms
-unsure 🔍
-12% - +3%
-5.88ms - +1.40ms
preact-hooks43.78ms - 49.07msslower ❌
2% - 17%
0.86ms - 7.17ms
unsure 🔍
-3% - +14%
-1.40ms - +5.88ms
-

run-warmup-3

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master52.49ms - 56.14ms-unsure 🔍
-3% - +8%
-1.67ms - +4.09ms
unsure 🔍
-3% - +9%
-1.27ms - +4.58ms
preact-local50.89ms - 55.34msunsure 🔍
-7% - +3%
-4.09ms - +1.67ms
-unsure 🔍
-5% - +7%
-2.75ms - +3.64ms
preact-hooks50.38ms - 54.95msunsure 🔍
-8% - +2%
-4.58ms - +1.27ms
unsure 🔍
-7% - +5%
-3.64ms - +2.75ms
-

run-warmup-4

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master51.93ms - 55.26ms-unsure 🔍
-2% - +6%
-1.18ms - +3.09ms
unsure 🔍
-3% - +4%
-1.77ms - +2.31ms
preact-local51.30ms - 53.97msunsure 🔍
-6% - +2%
-3.09ms - +1.18ms
-unsure 🔍
-5% - +2%
-2.47ms - +1.09ms
preact-hooks52.15ms - 54.50msunsure 🔍
-4% - +3%
-2.31ms - +1.77ms
unsure 🔍
-2% - +5%
-1.09ms - +2.47ms
-

run-final

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master32.93ms - 36.06ms-unsure 🔍
-7% - +6%
-2.29ms - +2.16ms
unsure 🔍
-11% - +2%
-4.01ms - +0.95ms
preact-local32.98ms - 36.13msunsure 🔍
-6% - +7%
-2.16ms - +2.29ms
-unsure 🔍
-11% - +3%
-3.95ms - +1.02ms
preact-hooks34.11ms - 37.94msunsure 🔍
-3% - +12%
-0.95ms - +4.01ms
unsure 🔍
-3% - +12%
-1.02ms - +3.95ms
-
03_update10th1k_x16

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master44.87ms - 47.42ms-unsure 🔍
-4% - +4%
-1.69ms - +1.77ms
unsure 🔍
-4% - +3%
-1.92ms - +1.53ms
preact-local44.93ms - 47.28msunsure 🔍
-4% - +4%
-1.77ms - +1.69ms
-unsure 🔍
-4% - +3%
-1.88ms - +1.42ms
preact-hooks45.18ms - 47.49msunsure 🔍
-3% - +4%
-1.53ms - +1.92ms
unsure 🔍
-3% - +4%
-1.42ms - +1.88ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.44ms - 3.45ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
faster ✔
0% - 1%
0.01ms - 0.03ms
preact-local3.44ms - 3.45msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-faster ✔
0% - 1%
0.01ms - 0.03ms
preact-hooks3.46ms - 3.47msslower ❌
0% - 1%
0.01ms - 0.03ms
slower ❌
0% - 1%
0.01ms - 0.03ms
-
07_create10k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1197.31ms - 1206.34ms-unsure 🔍
-1% - +0%
-11.89ms - +3.96ms
faster ✔
0% - 1%
1.55ms - 17.55ms
preact-local1199.28ms - 1212.31msunsure 🔍
-0% - +1%
-3.96ms - +11.89ms
-unsure 🔍
-1% - +0%
-14.86ms - +3.69ms
preact-hooks1204.77ms - 1217.99msslower ❌
0% - 1%
1.55ms - 17.55ms
unsure 🔍
-0% - +1%
-3.69ms - +14.86ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master25.36ms - 25.39ms-unsure 🔍
-0% - +0%
-0.02ms - +0.02ms
unsure 🔍
-0% - -0%
-0.05ms - -0.01ms
preact-local25.36ms - 25.39msunsure 🔍
-0% - +0%
-0.02ms - +0.02ms
-unsure 🔍
-0% - -0%
-0.05ms - -0.01ms
preact-hooks25.39ms - 25.42msunsure 🔍
+0% - +0%
+0.01ms - +0.05ms
unsure 🔍
+0% - +0%
+0.01ms - +0.05ms
-
filter_list

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master27.47ms - 28.20ms-unsure 🔍
-3% - +1%
-0.70ms - +0.23ms
unsure 🔍
-2% - +2%
-0.63ms - +0.43ms
preact-local27.78ms - 28.36msunsure 🔍
-1% - +3%
-0.23ms - +0.70ms
-unsure 🔍
-1% - +2%
-0.35ms - +0.62ms
preact-hooks27.55ms - 28.32msunsure 🔍
-2% - +2%
-0.43ms - +0.63ms
unsure 🔍
-2% - +1%
-0.62ms - +0.35ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.58ms - 1.58ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
1% - 1%
0.02ms - 0.02ms
preact-local1.58ms - 1.58msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
1% - 1%
0.02ms - 0.02ms
preact-hooks1.60ms - 1.60msslower ❌
1% - 1%
0.02ms - 0.02ms
slower ❌
1% - 1%
0.02ms - 0.02ms
-
hydrate1k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master111.85ms - 115.05ms-unsure 🔍
-3% - +1%
-2.92ms - +1.45ms
unsure 🔍
-2% - +2%
-1.96ms - +2.03ms
preact-local112.70ms - 115.67msunsure 🔍
-1% - +3%
-1.45ms - +2.92ms
-unsure 🔍
-1% - +2%
-1.13ms - +2.67ms
preact-hooks112.23ms - 114.60msunsure 🔍
-2% - +2%
-2.03ms - +1.96ms
unsure 🔍
-2% - +1%
-2.67ms - +1.13ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master12.18ms - 12.91ms-unsure 🔍
-6% - +2%
-0.78ms - +0.31ms
unsure 🔍
-6% - +2%
-0.77ms - +0.26ms
preact-local12.38ms - 13.18msunsure 🔍
-3% - +6%
-0.31ms - +0.78ms
-unsure 🔍
-4% - +4%
-0.56ms - +0.52ms
preact-hooks12.45ms - 13.16msunsure 🔍
-2% - +6%
-0.26ms - +0.77ms
unsure 🔍
-4% - +4%
-0.52ms - +0.56ms
-
many_updates

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master35.58ms - 37.15ms-unsure 🔍
-1% - +6%
-0.41ms - +2.02ms
unsure 🔍
-2% - +5%
-0.62ms - +1.80ms
preact-local34.63ms - 36.49msunsure 🔍
-6% - +1%
-2.02ms - +0.41ms
-unsure 🔍
-4% - +3%
-1.52ms - +1.10ms
preact-hooks34.85ms - 36.69msunsure 🔍
-5% - +2%
-1.80ms - +0.62ms
unsure 🔍
-3% - +4%
-1.10ms - +1.52ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master4.63ms - 4.63ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
unsure 🔍
-0% - +1%
-0.00ms - +0.03ms
preact-local4.63ms - 4.63msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-unsure 🔍
-0% - +1%
-0.00ms - +0.03ms
preact-hooks4.59ms - 4.63msunsure 🔍
-1% - +0%
-0.03ms - +0.00ms
unsure 🔍
-1% - +0%
-0.03ms - +0.00ms
-
text_update

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master2.80ms - 2.86ms-unsure 🔍
-1% - +2%
-0.04ms - +0.05ms
faster ✔
4% - 7%
0.13ms - 0.22ms
preact-local2.79ms - 2.86msunsure 🔍
-2% - +1%
-0.05ms - +0.04ms
-faster ✔
5% - 7%
0.14ms - 0.23ms
preact-hooks2.98ms - 3.04msslower ❌
5% - 8%
0.13ms - 0.22ms
slower ❌
5% - 8%
0.14ms - 0.23ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master0.81ms - 0.81ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
2% - 2%
0.01ms - 0.01ms
preact-local0.81ms - 0.81msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
2% - 2%
0.01ms - 0.01ms
preact-hooks0.83ms - 0.83msslower ❌
2% - 2%
0.01ms - 0.01ms
slower ❌
2% - 2%
0.01ms - 0.01ms
-
todo

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master51.87ms - 52.53ms-unsure 🔍
-1% - +0%
-0.75ms - +0.19ms
faster ✔
2% - 4%
1.20ms - 2.12ms
preact-local52.14ms - 52.81msunsure 🔍
-0% - +1%
-0.19ms - +0.75ms
-faster ✔
2% - 3%
0.91ms - 1.84ms
preact-hooks53.54ms - 54.17msslower ❌
2% - 4%
1.20ms - 2.12ms
slower ❌
2% - 4%
0.91ms - 1.84ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.07ms - 1.07ms-slower ❌
0% - 1%
0.00ms - 0.01ms
faster ✔
1% - 2%
0.01ms - 0.02ms
preact-local1.06ms - 1.07msfaster ✔
0% - 1%
0.00ms - 0.01ms
-faster ✔
2% - 2%
0.02ms - 0.02ms
preact-hooks1.09ms - 1.09msslower ❌
1% - 2%
0.01ms - 0.02ms
slower ❌
2% - 2%
0.02ms - 0.02ms
-

tachometer-reporter-action v2 for Benchmarks

@coveralls
Copy link

coveralls commented Mar 6, 2023

Coverage Status

Coverage: 99.701% (+0.003%) from 99.699% when pulling 49bab24 on controlled-inputs-compat into a9d9c64 on master.

@github-actions
Copy link

github-actions bot commented Mar 6, 2023

Size Change: +460 B (0%)

Total Size: 54.8 kB

Filename Size Change
compat/dist/compat.js 4.07 kB +152 B (3%)
compat/dist/compat.module.js 4 kB +157 B (3%)
compat/dist/compat.umd.js 4.13 kB +151 B (3%)
ℹ️ View Unchanged
Filename Size Change
debug/dist/debug.js 3 kB 0 B
debug/dist/debug.module.js 3.01 kB 0 B
debug/dist/debug.umd.js 3.08 kB 0 B
devtools/dist/devtools.js 232 B 0 B
devtools/dist/devtools.module.js 240 B 0 B
devtools/dist/devtools.umd.js 315 B 0 B
dist/preact.js 4.21 kB 0 B
dist/preact.min.js 4.24 kB 0 B
dist/preact.min.module.js 4.24 kB 0 B
dist/preact.min.umd.js 4.26 kB 0 B
dist/preact.module.js 4.23 kB 0 B
dist/preact.umd.js 4.27 kB 0 B
hooks/dist/hooks.js 1.53 kB 0 B
hooks/dist/hooks.module.js 1.56 kB 0 B
hooks/dist/hooks.umd.js 1.61 kB 0 B
jsx-runtime/dist/jsxRuntime.js 360 B 0 B
jsx-runtime/dist/jsxRuntime.module.js 326 B 0 B
jsx-runtime/dist/jsxRuntime.umd.js 441 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

@andrewiggins andrewiggins merged commit 59f7f7c into master Apr 6, 2023
@andrewiggins andrewiggins deleted the controlled-inputs-compat branch April 6, 2023 20:27
@JoviDeCroock JoviDeCroock mentioned this pull request May 13, 2023
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.

3 participants