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

Use queueMicrotask for scheduling #2354

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

Conversation

marvinhagemeister
Copy link
Member

By suggestion from @ mathiasbynens https://mobile.twitter.com/mathias/status/1229142133904478209 🎉

Size -11 B 🙌

@github-actions
Copy link

github-actions bot commented Feb 16, 2020

Size Change: +1.42 kB (3%)

Total Size: 41.9 kB

Filename Size Change
compat/dist/compat.js 3.39 kB +253 B (7%) 🔍
compat/dist/compat.module.js 3.38 kB +221 B (6%) 🔍
compat/dist/compat.umd.js 3.44 kB +249 B (7%) 🔍
debug/dist/debug.js 2.99 kB -5 B (0%)
debug/dist/debug.module.js 2.98 kB +4 B (0%)
debug/dist/debug.umd.js 3.07 kB -3 B (0%)
devtools/dist/devtools.js 232 B +47 B (20%) 🚨
devtools/dist/devtools.module.js 241 B +47 B (19%) ⚠️
devtools/dist/devtools.umd.js 308 B +48 B (15%) ⚠️
dist/preact.js 3.97 kB +108 B (2%)
dist/preact.min.js 3.99 kB +133 B (3%)
dist/preact.module.js 3.99 kB +107 B (2%)
dist/preact.umd.js 4.03 kB +118 B (2%)
hooks/dist/hooks.js 1.13 kB +29 B (2%)
hooks/dist/hooks.module.js 1.15 kB +30 B (2%)
hooks/dist/hooks.umd.js 1.2 kB +35 B (2%)
ℹ️ View Unchanged
Filename Size Change
jsx-runtime/dist/jsxRuntime.js 317 B 0 B
jsx-runtime/dist/jsxRuntime.module.js 327 B 0 B
jsx-runtime/dist/jsxRuntime.umd.js 395 B 0 B
test-utils/dist/testUtils.js 437 B 0 B
test-utils/dist/testUtils.module.js 439 B 0 B
test-utils/dist/testUtils.umd.js 515 B 0 B

compressed-size-action

@JoviDeCroock
Copy link
Member

JoviDeCroock commented Feb 16, 2020

This seems to have low browser compat though https://caniuse.com/#search=queueMicrotask (11% diff to Promise)

@coveralls
Copy link

coveralls commented Feb 16, 2020

Coverage Status

Coverage decreased (-0.2%) to 99.622% when pulling c2fa8fa on queue-microtask into 2b7397a on master.

@marvinhagemeister
Copy link
Member Author

Good point. The data seems to be incorrect about edge though. The latest version does haver queueMicrotask available.

@developit
Copy link
Member

Would love to get performance numbers for this change. The size decrease is awesome, but we'll want to be confident about the perf of this (and of setTimeout fallback in Edge <= 18) to merge.

Copy link
Member

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

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

I've been thinking about this and if setTimeout isn't a serious thing (which it shouldn't) I'm up for this.

@marvinhagemeister
Copy link
Member Author

We're hesitant to make the switch right now as that would push a lot of browsers over to setTimeout. We'll revisit this in the future when the browserlandscape has changed a bit 👍

@ForsakenHarmony ForsakenHarmony deleted the queue-microtask branch May 21, 2021 22:19
@ForsakenHarmony ForsakenHarmony restored the queue-microtask branch May 21, 2021 22:20
@github-actions
Copy link

github-actions bot commented May 21, 2021

📊 Tachometer Benchmark Results

Summary

duration

  • 02_replace1k: unsure 🔍 -1% - +3% (-1.61ms - +3.32ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -4% - +5% (-1.47ms - +1.64ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -0% - +0% (-3.27ms - +2.84ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -2% - +2% (-0.33ms - +0.44ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -4% - +1% (-5.06ms - +1.72ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -2% - +6% (-0.73ms - +2.27ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 -2% - +5% (-0.06ms - +0.19ms)
    preact-local vs preact-master

usedJSHeapSize

  • 02_replace1k: unsure 🔍 -1% - +0% (-0.02ms - +0.01ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -0% - +0% (-0.01ms - +0.02ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -1% - +3% (-0.01ms - +0.05ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -1% - +0% (-0.07ms - +0.02ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 -0% - -0% (-0.00ms - -0.00ms)
    preact-local vs preact-master

Results

02_replace1k

duration

VersionAvg timevs preact-mastervs preact-local
preact-master128.90ms - 132.65ms-unsure 🔍
-3% - +1%
-3.32ms - +1.61ms
preact-local130.03ms - 133.24msunsure 🔍
-1% - +3%
-1.61ms - +3.32ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master3.55ms - 3.58ms-unsure 🔍
-0% - +1%
-0.01ms - +0.02ms
preact-local3.55ms - 3.57msunsure 🔍
-1% - +0%
-0.02ms - +0.01ms
-

run-warmup-0

VersionAvg timevs preact-mastervs preact-local
preact-master52.89ms - 53.64ms-unsure 🔍
-0% - +2%
-0.25ms - +0.80ms
preact-local52.62ms - 53.36msunsure 🔍
-2% - +0%
-0.80ms - +0.25ms
-

run-warmup-1

VersionAvg timevs preact-mastervs preact-local
preact-master85.76ms - 87.13ms-unsure 🔍
-1% - +1%
-1.01ms - +0.72ms
preact-local86.06ms - 87.12msunsure 🔍
-1% - +1%
-0.72ms - +1.01ms
-

run-warmup-2

VersionAvg timevs preact-mastervs preact-local
preact-master75.74ms - 83.93ms-unsure 🔍
-10% - +4%
-7.88ms - +3.50ms
preact-local78.08ms - 85.97msunsure 🔍
-4% - +10%
-3.50ms - +7.88ms
-

run-warmup-3

VersionAvg timevs preact-mastervs preact-local
preact-master59.42ms - 67.77ms-unsure 🔍
-1% - +17%
-0.59ms - +10.11ms
preact-local55.50ms - 62.17msunsure 🔍
-16% - +1%
-10.11ms - +0.59ms
-

run-warmup-4

VersionAvg timevs preact-mastervs preact-local
preact-master81.48ms - 84.86ms-faster ✔
0% - 5%
0.18ms - 4.49ms
preact-local84.17ms - 86.84msslower ❌
0% - 5%
0.18ms - 4.49ms
-

run-final

VersionAvg timevs preact-mastervs preact-local
preact-master50.46ms - 53.24ms-unsure 🔍
-4% - +4%
-1.85ms - +1.95ms
preact-local50.50ms - 53.09msunsure 🔍
-4% - +4%
-1.95ms - +1.85ms
-
03_update10th1k_x16

duration

VersionAvg timevs preact-mastervs preact-local
preact-master34.46ms - 36.70ms-unsure 🔍
-5% - +4%
-1.64ms - +1.47ms
preact-local34.58ms - 36.75msunsure 🔍
-4% - +5%
-1.47ms - +1.64ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master3.57ms - 3.59ms-unsure 🔍
-0% - +0%
-0.02ms - +0.01ms
preact-local3.58ms - 3.60msunsure 🔍
-0% - +0%
-0.01ms - +0.02ms
-
07_create10k

duration

VersionAvg timevs preact-mastervs preact-local
preact-master1249.06ms - 1253.01ms-unsure 🔍
-0% - +0%
-2.84ms - +3.27ms
preact-local1248.50ms - 1253.15msunsure 🔍
-0% - +0%
-3.27ms - +2.84ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master25.38ms - 25.38ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-local25.38ms - 25.38msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
filter_list

duration

VersionAvg timevs preact-mastervs preact-local
preact-master21.52ms - 21.93ms-unsure 🔍
-2% - +2%
-0.44ms - +0.33ms
preact-local21.45ms - 22.11msunsure 🔍
-2% - +2%
-0.33ms - +0.44ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master1.64ms - 1.69ms-unsure 🔍
-3% - +1%
-0.05ms - +0.01ms
preact-local1.66ms - 1.71msunsure 🔍
-1% - +3%
-0.01ms - +0.05ms
-
hydrate1k

duration

VersionAvg timevs preact-mastervs preact-local
preact-master115.04ms - 119.90ms-unsure 🔍
-2% - +4%
-1.72ms - +5.06ms
preact-local113.44ms - 118.16msunsure 🔍
-4% - +1%
-5.06ms - +1.72ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master6.29ms - 6.35ms-unsure 🔍
-0% - +1%
-0.02ms - +0.07ms
preact-local6.27ms - 6.33msunsure 🔍
-1% - +0%
-0.07ms - +0.02ms
-
many_updates

duration

VersionAvg timevs preact-mastervs preact-local
preact-master35.15ms - 37.16ms-unsure 🔍
-6% - +2%
-2.27ms - +0.73ms
preact-local35.81ms - 38.04msunsure 🔍
-2% - +6%
-0.73ms - +2.27ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master4.65ms - 4.67ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
preact-local4.65ms - 4.67msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-
text_update

duration

VersionAvg timevs preact-mastervs preact-local
preact-master3.72ms - 3.85ms-unsure 🔍
-5% - +1%
-0.19ms - +0.06ms
preact-local3.74ms - 3.95msunsure 🔍
-2% - +5%
-0.06ms - +0.19ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master0.83ms - 0.83ms-unsure 🔍
+0% - +0%
+0.00ms - +0.00ms
preact-local0.83ms - 0.83msunsure 🔍
-0% - -0%
-0.00ms - -0.00ms
-

tachometer-reporter-action v2 for Benchmarks

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.

None yet

5 participants