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

[ReactiveElement] Adds scheduleUpdate() #2097

Merged
merged 4 commits into from
Aug 27, 2021
Merged

[ReactiveElement] Adds scheduleUpdate() #2097

merged 4 commits into from
Aug 27, 2021

Conversation

sorvell
Copy link
Member

@sorvell sorvell commented Aug 26, 2021

Fixes #2091. Fixes an issue where performUpdate was doing double duty as (1) make the element complete a pending update synchronously and (2) override to control update timing. Here scheduleUpdate() is added to satisfy (2), reserving (1) for performUpdate(). Since by default scheduleUpdate() just returns the value of performUpdate() this should not break any existing code. However, the docs are updated to recommend that for scheduling scheduleUpdate() be implemented in favor of performUpdate().

Steven Orvell added 2 commits August 26, 2021 15:57
Fixes #2091. Fixes an issue where `performUpdate` was doing double duty as (1) make the element complete a pending update synchronously and (2) override to control update timing. Here `scheduleUpdate()` is added to satisfy (2), reserving (1) for `performUpdate()`. Since  by default `scheduleUpdate()` just returns the value of `performUpdate()` this should not break any existing code. However, the docs are updated to recommend that for scheduling `scheduleUpdate()` be implemented in favor of `performUpdate()`.
@sorvell sorvell added this to the Lit RC.next milestone Aug 26, 2021
@changeset-bot
Copy link

changeset-bot bot commented Aug 26, 2021

🦋 Changeset detected

Latest commit: b2beae2

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@google-cla google-cla bot added the cla: yes label Aug 26, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Aug 26, 2021

📊 Tachometer Benchmark Results

Summary

nop-update

  • lit-html-kitchen-sink: unsure 🔍 -6% - +5% (-2.47ms - +2.31ms)
    this-change vs tip-of-tree

render

  • lit-element-list: unsure 🔍 -4% - +3% (-5.13ms - +3.44ms)
    this-change vs tip-of-tree
  • lit-html-kitchen-sink: unsure 🔍 -4% - +7% (-2.03ms - +3.30ms)
    this-change vs tip-of-tree
  • lit-html-repeat: unsure 🔍 -3% - +5% (-0.46ms - +0.71ms)
    this-change vs tip-of-tree
  • lit-html-template-heavy: unsure 🔍 -3% - +4% (-2.46ms - +3.51ms)
    this-change vs tip-of-tree
  • reactive-element-list: unsure 🔍 -3% - +3% (-2.79ms - +2.09ms)
    this-change vs tip-of-tree

update

  • lit-element-list: unsure 🔍 -3% - +2% (-28.79ms - +24.74ms)
    this-change vs tip-of-tree
  • lit-html-kitchen-sink: unsure 🔍 -8% - +4% (-9.54ms - +5.54ms)
    this-change vs tip-of-tree
  • lit-html-repeat: unsure 🔍 -1% - +4% (-6.40ms - +19.55ms)
    this-change vs tip-of-tree
  • lit-html-template-heavy: unsure 🔍 -1% - +7% (-1.70ms - +11.27ms)
    this-change vs tip-of-tree
  • reactive-element-list: unsure 🔍 -2% - +3% (-20.19ms - +35.27ms)
    this-change vs tip-of-tree

update-reflect

  • lit-element-list: unsure 🔍 -4% - +3% (-36.55ms - +25.77ms)
    this-change vs tip-of-tree
  • reactive-element-list: unsure 🔍 -1% - +4% (-13.80ms - +41.29ms)
    this-change vs tip-of-tree

Results

lit-element-list

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
115.53ms - 121.46ms-unsure 🔍
-4% - +3%
-5.13ms - +3.44ms
faster ✔
21% - 26%
31.09ms - 40.81ms
tip-of-tree
tip-of-tree
116.25ms - 122.44msunsure 🔍
-3% - +4%
-3.44ms - +5.13ms
-faster ✔
20% - 26%
30.17ms - 40.05ms
previous-release
previous-release
150.60ms - 158.30msslower ❌
26% - 35%
31.09ms - 40.81ms
slower ❌
25% - 34%
30.17ms - 40.05ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
989.03ms - 1025.35ms-unsure 🔍
-3% - +2%
-28.79ms - +24.74ms
faster ✔
6% - 11%
63.70ms - 120.58ms
tip-of-tree
tip-of-tree
989.55ms - 1028.87msunsure 🔍
-2% - +3%
-24.74ms - +28.79ms
-faster ✔
6% - 11%
60.70ms - 119.53ms
previous-release
previous-release
1077.45ms - 1121.22msslower ❌
6% - 12%
63.70ms - 120.58ms
slower ❌
6% - 12%
60.70ms - 119.53ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
998.13ms - 1043.22ms-unsure 🔍
-4% - +3%
-36.55ms - +25.77ms
faster ✔
3% - 9%
33.23ms - 100.11ms
tip-of-tree
tip-of-tree
1004.56ms - 1047.57msunsure 🔍
-3% - +4%
-25.77ms - +36.55ms
-faster ✔
3% - 9%
28.53ms - 94.03ms
previous-release
previous-release
1062.65ms - 1112.04msslower ❌
3% - 10%
33.23ms - 100.11ms
slower ❌
3% - 9%
28.53ms - 94.03ms
-
lit-html-kitchen-sink

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
46.82ms - 51.05ms-unsure 🔍
-4% - +7%
-2.03ms - +3.30ms
faster ✔
12% - 21%
6.85ms - 12.22ms
tip-of-tree
tip-of-tree
46.68ms - 49.92msunsure 🔍
-7% - +4%
-3.30ms - +2.03ms
-faster ✔
14% - 21%
7.85ms - 12.49ms
previous-release
previous-release
56.81ms - 60.13msslower ❌
13% - 26%
6.85ms - 12.22ms
slower ❌
16% - 26%
7.85ms - 12.49ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
117.39ms - 126.96ms-unsure 🔍
-8% - +4%
-9.54ms - +5.54ms
unsure 🔍
-9% - +0%
-11.63ms - +0.73ms
tip-of-tree
tip-of-tree
118.34ms - 130.01msunsure 🔍
-5% - +8%
-5.54ms - +9.54ms
-unsure 🔍
-8% - +3%
-10.47ms - +3.57ms
previous-release
previous-release
123.72ms - 131.54msunsure 🔍
-1% - +10%
-0.73ms - +11.63ms
unsure 🔍
-3% - +9%
-3.57ms - +10.47ms
-

nop-update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
41.96ms - 45.83ms-unsure 🔍
-6% - +5%
-2.47ms - +2.31ms
slower ❌
2% - 13%
0.67ms - 5.23ms
tip-of-tree
tip-of-tree
42.58ms - 45.37msunsure 🔍
-5% - +6%
-2.31ms - +2.47ms
-slower ❌
3% - 12%
1.18ms - 4.87ms
previous-release
previous-release
39.74ms - 42.15msfaster ✔
2% - 12%
0.67ms - 5.23ms
faster ✔
3% - 11%
1.18ms - 4.87ms
-
lit-html-repeat

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
14.21ms - 15.13ms-unsure 🔍
-3% - +5%
-0.46ms - +0.71ms
faster ✔
13% - 21%
2.18ms - 3.72ms
tip-of-tree
tip-of-tree
14.18ms - 14.91msunsure 🔍
-5% - +3%
-0.71ms - +0.46ms
-faster ✔
14% - 21%
2.36ms - 3.79ms
previous-release
previous-release
17.00ms - 18.24msslower ❌
14% - 26%
2.18ms - 3.72ms
slower ❌
16% - 26%
2.36ms - 3.79ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
445.65ms - 463.37ms-unsure 🔍
-1% - +4%
-6.40ms - +19.55ms
faster ✔
27% - 30%
166.18ms - 193.76ms
tip-of-tree
tip-of-tree
438.45ms - 457.41msunsure 🔍
-4% - +1%
-19.55ms - +6.40ms
-faster ✔
27% - 31%
172.35ms - 200.74ms
previous-release
previous-release
623.91ms - 645.04msslower ❌
36% - 43%
166.18ms - 193.76ms
slower ❌
38% - 45%
172.35ms - 200.74ms
-
lit-html-template-heavy

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
78.46ms - 82.50ms-unsure 🔍
-3% - +4%
-2.46ms - +3.51ms
faster ✔
13% - 18%
12.04ms - 17.26ms
tip-of-tree
tip-of-tree
77.76ms - 82.15msunsure 🔍
-4% - +3%
-3.51ms - +2.46ms
-faster ✔
13% - 19%
12.43ms - 17.92ms
previous-release
previous-release
93.48ms - 96.78msslower ❌
15% - 22%
12.04ms - 17.26ms
slower ❌
15% - 23%
12.43ms - 17.92ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
168.57ms - 178.98ms-unsure 🔍
-1% - +7%
-1.70ms - +11.27ms
faster ✔
6% - 13%
10.96ms - 25.16ms
tip-of-tree
tip-of-tree
165.11ms - 172.86msunsure 🔍
-6% - +1%
-11.27ms - +1.70ms
-faster ✔
9% - 15%
16.65ms - 29.04ms
previous-release
previous-release
187.00ms - 196.66msslower ❌
6% - 15%
10.96ms - 25.16ms
slower ❌
10% - 17%
16.65ms - 29.04ms
-
reactive-element-list

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
78.07ms - 81.27ms-unsure 🔍
-3% - +3%
-2.79ms - +2.09ms
unsure 🔍
-2% - +3%
-1.40ms - +2.59ms
tip-of-tree
tip-of-tree
78.18ms - 81.87msunsure 🔍
-3% - +4%
-2.09ms - +2.79ms
-unsure 🔍
-2% - +4%
-1.25ms - +3.14ms
previous-release
previous-release
77.88ms - 80.27msunsure 🔍
-3% - +2%
-2.59ms - +1.40ms
unsure 🔍
-4% - +2%
-3.14ms - +1.25ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
999.00ms - 1041.05ms-unsure 🔍
-2% - +3%
-20.19ms - +35.27ms
unsure 🔍
-2% - +3%
-19.72ms - +34.02ms
tip-of-tree
tip-of-tree
994.40ms - 1030.56msunsure 🔍
-3% - +2%
-35.27ms - +20.19ms
-unsure 🔍
-2% - +2%
-25.03ms - +24.24ms
previous-release
previous-release
996.14ms - 1029.61msunsure 🔍
-3% - +2%
-34.02ms - +19.72ms
unsure 🔍
-2% - +2%
-24.24ms - +25.03ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
1068.70ms - 1111.23ms-unsure 🔍
-1% - +4%
-13.80ms - +41.29ms
unsure 🔍
-1% - +4%
-14.36ms - +45.98ms
tip-of-tree
tip-of-tree
1058.72ms - 1093.73msunsure 🔍
-4% - +1%
-41.29ms - +13.80ms
-unsure 🔍
-2% - +3%
-25.58ms - +29.71ms
previous-release
previous-release
1052.76ms - 1095.56msunsure 🔍
-4% - +1%
-45.98ms - +14.36ms
unsure 🔍
-3% - +2%
-29.71ms - +25.58ms
-

tachometer-reporter-action v2 for Benchmarks

* method is overridden, `super.performUpdate()` must be called.
* Schedules an element update. You can override this method to change the
* timing of updates. If this method is overridden, `super.scheduleUpdate()`
* must be called.
Copy link
Member

Choose a reason for hiding this comment

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

Add that it should return a promise when overridden.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Co-authored-by: Justin Fagnani <justinfagnani@google.com>
@sorvell sorvell merged commit 2b8dd1c into main Aug 27, 2021
@sorvell sorvell deleted the scheduleUpdate branch August 27, 2021 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ReactiveElement] Add scheduleUpdate method
3 participants