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

Optimization for aria-/data- attr detection #3948

Merged
merged 1 commit into from
Mar 27, 2023
Merged

Conversation

developit
Copy link
Member

@developit developit commented Mar 25, 2023

Both of the attributes that need false to render as the string "false" rather than triggering attribute removal have a prefix of length 4, which puts the - character in the same position. This means we can avoid a string search and directly check if an attribute is a data- or aria- attribute:

'aria-label'[4] === '-'
'data-foo'[4] === '-'

@github-actions
Copy link

github-actions bot commented Mar 25, 2023

📊 Tachometer Benchmark Results

Summary

duration

  • 02_replace1k: unsure 🔍 -2% - +2% (-4.60ms - +3.44ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -2% - +5% (-1.12ms - +2.82ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -1% - +0% (-11.78ms - +4.56ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -1% - +3% (-0.13ms - +0.57ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -1% - +4% (-1.10ms - +6.06ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -2% - +5% (-0.74ms - +1.73ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 -2% - +2% (-0.04ms - +0.05ms)
    preact-local vs preact-master
  • todo: unsure 🔍 -1% - +1% (-0.59ms - +0.28ms)
    preact-local vs preact-master

usedJSHeapSize

  • 02_replace1k: unsure 🔍 -6% - +5% (-0.20ms - +0.19ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -0% - +0% (-0.01ms - +0.00ms)
    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 🔍 -5% - +2% (-0.76ms - +0.31ms)
    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: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master

Results

02_replace1k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master185.86ms - 191.86ms-unsure 🔍
-2% - +2%
-3.44ms - +4.60ms
unsure 🔍
-2% - +2%
-3.34ms - +4.38ms
preact-local185.60ms - 190.97msunsure 🔍
-2% - +2%
-4.60ms - +3.44ms
-unsure 🔍
-2% - +2%
-3.68ms - +3.56ms
preact-hooks185.91ms - 190.77msunsure 🔍
-2% - +2%
-4.38ms - +3.34ms
unsure 🔍
-2% - +2%
-3.56ms - +3.68ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.41ms - 3.73ms-unsure 🔍
-5% - +6%
-0.19ms - +0.20ms
unsure 🔍
-4% - +5%
-0.16ms - +0.19ms
preact-local3.45ms - 3.69msunsure 🔍
-6% - +5%
-0.20ms - +0.19ms
-unsure 🔍
-4% - +4%
-0.13ms - +0.15ms
preact-hooks3.48ms - 3.63msunsure 🔍
-5% - +4%
-0.19ms - +0.16ms
unsure 🔍
-4% - +3%
-0.15ms - +0.13ms
-

run-warmup-0

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master59.14ms - 61.38ms-unsure 🔍
-0% - +5%
-0.25ms - +2.85ms
unsure 🔍
-5% - -0%
-2.93ms - +0.01ms
preact-local57.88ms - 60.04msunsure 🔍
-5% - +0%
-2.85ms - +0.25ms
-faster ✔
2% - 7%
1.32ms - 4.20ms
preact-hooks60.77ms - 62.68msunsure 🔍
-0% - +5%
-0.01ms - +2.93ms
slower ❌
2% - 7%
1.32ms - 4.20ms
-

run-warmup-1

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master86.60ms - 89.79ms-unsure 🔍
-3% - +2%
-2.47ms - +1.88ms
unsure 🔍
-5% - +0%
-4.08ms - +0.30ms
preact-local87.00ms - 89.98msunsure 🔍
-2% - +3%
-1.88ms - +2.47ms
-unsure 🔍
-4% - +1%
-3.71ms - +0.52ms
preact-hooks88.58ms - 91.59msunsure 🔍
-0% - +5%
-0.30ms - +4.08ms
unsure 🔍
-1% - +4%
-0.52ms - +3.71ms
-

run-warmup-2

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master64.83ms - 68.95ms-unsure 🔍
-8% - +1%
-5.74ms - +0.65ms
faster ✔
0% - 8%
0.05ms - 5.66ms
preact-local66.99ms - 71.88msunsure 🔍
-1% - +9%
-0.65ms - +5.74ms
-unsure 🔍
-5% - +4%
-3.41ms - +2.79ms
preact-hooks67.83ms - 71.66msunsure 🔍
-0% - +9%
+0.05ms - +5.66ms
unsure 🔍
-4% - +5%
-2.79ms - +3.41ms
-

run-warmup-3

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master75.63ms - 81.04ms-unsure 🔍
-3% - +6%
-2.58ms - +4.61ms
unsure 🔍
-6% - +3%
-5.15ms - +2.44ms
preact-local74.95ms - 79.69msunsure 🔍
-6% - +3%
-4.61ms - +2.58ms
-unsure 🔍
-7% - +1%
-5.93ms - +1.19ms
preact-hooks77.03ms - 82.35msunsure 🔍
-3% - +7%
-2.44ms - +5.15ms
unsure 🔍
-2% - +8%
-1.19ms - +5.93ms
-

run-warmup-4

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master81.23ms - 84.29ms-unsure 🔍
-3% - +3%
-2.15ms - +2.14ms
unsure 🔍
-5% - +0%
-4.37ms - +0.27ms
preact-local81.26ms - 84.27msunsure 🔍
-3% - +3%
-2.14ms - +2.15ms
-unsure 🔍
-5% - +0%
-4.35ms - +0.25ms
preact-hooks83.08ms - 86.55msunsure 🔍
-0% - +5%
-0.27ms - +4.37ms
unsure 🔍
-0% - +5%
-0.25ms - +4.35ms
-

run-final

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master57.13ms - 61.29ms-unsure 🔍
-1% - +8%
-0.80ms - +4.75ms
unsure 🔍
-3% - +7%
-1.45ms - +4.23ms
preact-local55.40ms - 59.07msunsure 🔍
-8% - +1%
-4.75ms - +0.80ms
-unsure 🔍
-6% - +4%
-3.25ms - +2.08ms
preact-hooks55.88ms - 59.76msunsure 🔍
-7% - +2%
-4.23ms - +1.45ms
unsure 🔍
-4% - +6%
-2.08ms - +3.25ms
-
03_update10th1k_x16

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master55.10ms - 57.92ms-unsure 🔍
-5% - +2%
-2.82ms - +1.12ms
unsure 🔍
-4% - +4%
-2.34ms - +2.04ms
preact-local55.98ms - 58.73msunsure 🔍
-2% - +5%
-1.12ms - +2.82ms
-unsure 🔍
-3% - +5%
-1.48ms - +2.87ms
preact-hooks54.98ms - 58.34msunsure 🔍
-4% - +4%
-2.04ms - +2.34ms
unsure 🔍
-5% - +3%
-2.87ms - +1.48ms
-

usedJSHeapSize

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

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1193.35ms - 1206.97ms-unsure 🔍
-0% - +1%
-4.56ms - +11.78ms
unsure 🔍
-1% - +0%
-14.13ms - +4.61ms
preact-local1192.05ms - 1201.06msunsure 🔍
-1% - +0%
-11.78ms - +4.56ms
-faster ✔
0% - 1%
0.51ms - 16.23ms
preact-hooks1198.49ms - 1211.36msunsure 🔍
-0% - +1%
-4.61ms - +14.13ms
slower ❌
0% - 1%
0.51ms - 16.23ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master25.36ms - 25.38ms-unsure 🔍
-0% - +0%
-0.02ms - +0.02ms
unsure 🔍
-0% - -0%
-0.05ms - -0.01ms
preact-local25.36ms - 25.38msunsure 🔍
-0% - +0%
-0.02ms - +0.02ms
-unsure 🔍
-0% - -0%
-0.05ms - -0.01ms
preact-hooks25.38ms - 25.41msunsure 🔍
+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-master22.52ms - 23.01ms-unsure 🔍
-2% - +1%
-0.57ms - +0.13ms
unsure 🔍
-1% - +1%
-0.34ms - +0.31ms
preact-local22.74ms - 23.24msunsure 🔍
-1% - +3%
-0.13ms - +0.57ms
-unsure 🔍
-1% - +2%
-0.12ms - +0.53ms
preact-hooks22.57ms - 22.99msunsure 🔍
-1% - +2%
-0.31ms - +0.34ms
unsure 🔍
-2% - +1%
-0.53ms - +0.12ms
-

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-master142.01ms - 146.62ms-unsure 🔍
-4% - +1%
-6.06ms - +1.10ms
unsure 🔍
-2% - +2%
-2.76ms - +2.98ms
preact-local144.06ms - 149.53msunsure 🔍
-1% - +4%
-1.10ms - +6.06ms
-unsure 🔍
-0% - +4%
-0.64ms - +5.81ms
preact-hooks142.50ms - 145.92msunsure 🔍
-2% - +2%
-2.98ms - +2.76ms
unsure 🔍
-4% - +0%
-5.81ms - +0.64ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master14.95ms - 15.69ms-unsure 🔍
-2% - +5%
-0.31ms - +0.76ms
unsure 🔍
-2% - +5%
-0.28ms - +0.70ms
preact-local14.71ms - 15.48msunsure 🔍
-5% - +2%
-0.76ms - +0.31ms
-unsure 🔍
-3% - +3%
-0.52ms - +0.49ms
preact-hooks14.79ms - 15.43msunsure 🔍
-5% - +2%
-0.70ms - +0.28ms
unsure 🔍
-3% - +3%
-0.49ms - +0.52ms
-
many_updates

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master33.81ms - 35.63ms-unsure 🔍
-5% - +2%
-1.73ms - +0.74ms
unsure 🔍
-6% - +2%
-2.06ms - +0.65ms
preact-local34.39ms - 36.06msunsure 🔍
-2% - +5%
-0.74ms - +1.73ms
-unsure 🔍
-4% - +3%
-1.51ms - +1.10ms
preact-hooks34.43ms - 36.43msunsure 🔍
-2% - +6%
-0.65ms - +2.06ms
unsure 🔍
-3% - +4%
-1.10ms - +1.51ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master4.63ms - 4.63ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
slower ❌
0% - 1%
0.01ms - 0.05ms
preact-local4.63ms - 4.63msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-slower ❌
0% - 1%
0.01ms - 0.05ms
preact-hooks4.58ms - 4.61msfaster ✔
0% - 1%
0.01ms - 0.05ms
faster ✔
0% - 1%
0.01ms - 0.05ms
-
text_update

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master2.83ms - 2.89ms-unsure 🔍
-2% - +2%
-0.05ms - +0.04ms
faster ✔
3% - 6%
0.09ms - 0.18ms
preact-local2.83ms - 2.90msunsure 🔍
-2% - +2%
-0.04ms - +0.05ms
-faster ✔
3% - 6%
0.09ms - 0.18ms
preact-hooks2.96ms - 3.03msslower ❌
3% - 6%
0.09ms - 0.18ms
slower ❌
3% - 6%
0.09ms - 0.18ms
-

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-master52.46ms - 52.96ms-unsure 🔍
-1% - +1%
-0.28ms - +0.59ms
faster ✔
1% - 3%
0.80ms - 1.44ms
preact-local52.20ms - 52.92msunsure 🔍
-1% - +1%
-0.59ms - +0.28ms
-faster ✔
2% - 3%
0.87ms - 1.68ms
preact-hooks53.64ms - 54.03msslower ❌
2% - 3%
0.80ms - 1.44ms
slower ❌
2% - 3%
0.87ms - 1.68ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.07ms - 1.07ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
2% - 2%
0.02ms - 0.02ms
preact-local1.07ms - 1.07msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
2% - 2%
0.02ms - 0.02ms
preact-hooks1.09ms - 1.09msslower ❌
2% - 2%
0.02ms - 0.02ms
slower ❌
2% - 2%
0.02ms - 0.02ms
-

tachometer-reporter-action v2 for Benchmarks

@coveralls
Copy link

coveralls commented Mar 25, 2023

Coverage Status

Coverage: 99.548% (+0.0007%) from 99.547% when pulling 66035ad on opt-aria-data into 9035b54 on master.

@github-actions
Copy link

Size Change: -8 B (0%)

Total Size: 54.3 kB

Filename Size Change
dist/preact.js 4.21 kB -1 B
dist/preact.min.js 4.24 kB -1 B
dist/preact.min.module.js 4.24 kB -1 B
dist/preact.min.umd.js 4.27 kB -2 B (0%)
dist/preact.module.js 4.23 kB -2 B (0%)
dist/preact.umd.js 4.27 kB -1 B
ℹ️ View Unchanged
Filename Size Change
compat/dist/compat.js 3.91 kB 0 B
compat/dist/compat.module.js 3.84 kB 0 B
compat/dist/compat.umd.js 3.98 kB 0 B
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 231 B 0 B
devtools/dist/devtools.module.js 240 B 0 B
devtools/dist/devtools.umd.js 315 B 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

@JoviDeCroock JoviDeCroock merged commit fcb003f into master Mar 27, 2023
@JoviDeCroock JoviDeCroock deleted the opt-aria-data branch March 27, 2023 06:58
JoviDeCroock added a commit that referenced this pull request Jan 16, 2024
JoviDeCroock added a commit that referenced this pull request Jan 16, 2024
* backport #3911

* backport #3906

* backport #3837

* backport #3908

* backport #3904

* backport #3905

* backport #3898

* backport #3910

* backport #3948

* backport #3941

* backport #3945

* backport #3919

* backport #3922

* backport #3921

* backport #3903

* fix lint

* update more

* debug
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