Skip to content

WIP: ReactElement base class#2354

Draft
justinfagnani wants to merge 1 commit into
mainfrom
react-element
Draft

WIP: ReactElement base class#2354
justinfagnani wants to merge 1 commit into
mainfrom
react-element

Conversation

@justinfagnani

Copy link
Copy Markdown
Collaborator

Addresses #2353

WIP: This is the very first cut of this code, ported from a similar base class for Preact: https://stackblitz.com/edit/preact-element?file=preact-element.ts

I presume there will be more to figure out to make this robust, especially:

  • Basics
    • Does React work well in a shadow root? Do we have to do anything to get React's delegating event handlers wired up?
    • Do we need to do anything special with children / slots?
  • Events
    • Can we make creating events for event-props more automatic?
    • What happens for components that change behavior based on the presence of an event callback? We can't quite do the same in the DOM where we don't know if there are any listeners and always have to fire the event. Is there a pattern we can recommend? Can we find examples?
  • Suspense
    • Can we catch Suspense errors and turn them into Pending Task events?
    • Should Suspense delay the updateComplete Promise?
  • Context
    • Can we map the Context Protocol into React contexts? (we should also investigate the inverse for createComponent())

@changeset-bot

changeset-bot Bot commented Dec 9, 2021

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: e43a1de

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions

github-actions Bot commented Dec 9, 2021

Copy link
Copy Markdown
Contributor

📊 Tachometer Benchmark Results

Summary

nop-update

  • lit-html-kitchen-sink: unsure 🔍 -6% - +1% (-2.06ms - +0.40ms)
    this-change vs tip-of-tree

render

  • lit-element-list: unsure 🔍 -4% - +2% (-4.34ms - +1.76ms)
    this-change vs tip-of-tree
  • lit-html-kitchen-sink: unsure 🔍 -4% - +3% (-1.73ms - +1.25ms)
    this-change vs tip-of-tree
  • lit-html-repeat: unsure 🔍 -4% - +5% (-0.54ms - +0.70ms)
    this-change vs tip-of-tree
  • lit-html-template-heavy: unsure 🔍 -3% - +3% (-1.59ms - +1.79ms)
    this-change vs tip-of-tree
  • reactive-element-list: unsure 🔍 -2% - +3% (-1.59ms - +2.17ms)
    this-change vs tip-of-tree

update

  • lit-element-list: unsure 🔍 -4% - +2% (-35.31ms - +18.58ms)
    this-change vs tip-of-tree
  • lit-html-kitchen-sink: unsure 🔍 -4% - +6% (-4.00ms - +6.34ms)
    this-change vs tip-of-tree
  • lit-html-repeat: unsure 🔍 -5% - +6% (-17.99ms - +19.01ms)
    this-change vs tip-of-tree
  • lit-html-template-heavy: unsure 🔍 -4% - +1% (-5.77ms - +1.88ms)
    this-change vs tip-of-tree
  • reactive-element-list: unsure 🔍 -2% - +3% (-16.75ms - +26.01ms)
    this-change vs tip-of-tree

update-reflect

  • lit-element-list: unsure 🔍 -3% - +3% (-29.72ms - +30.96ms)
    this-change vs tip-of-tree
  • reactive-element-list: unsure 🔍 -1% - +3% (-10.33ms - +31.78ms)
    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
93.53ms - 97.92ms-unsure 🔍
-4% - +2%
-4.34ms - +1.76ms
faster ✔
22% - 26%
26.62ms - 33.12ms
tip-of-tree
tip-of-tree
94.90ms - 99.13msunsure 🔍
-2% - +5%
-1.76ms - +4.34ms
-faster ✔
21% - 25%
25.38ms - 31.77ms
previous-release
previous-release
123.20ms - 127.99msslower ❌
27% - 35%
26.62ms - 33.12ms
slower ❌
26% - 33%
25.38ms - 31.77ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
883.28ms - 917.72ms-unsure 🔍
-4% - +2%
-35.31ms - +18.58ms
faster ✔
6% - 12%
61.56ms - 116.39ms
tip-of-tree
tip-of-tree
888.14ms - 929.59msunsure 🔍
-2% - +4%
-18.58ms - +35.31ms
-faster ✔
5% - 11%
50.86ms - 110.35ms
previous-release
previous-release
968.14ms - 1010.80msslower ❌
7% - 13%
61.56ms - 116.39ms
slower ❌
5% - 12%
50.86ms - 110.35ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
977.00ms - 1020.28ms-unsure 🔍
-3% - +3%
-29.72ms - +30.96ms
faster ✔
2% - 7%
15.78ms - 73.87ms
tip-of-tree
tip-of-tree
976.75ms - 1019.28msunsure 🔍
-3% - +3%
-30.96ms - +29.72ms
-faster ✔
2% - 7%
16.68ms - 74.21ms
previous-release
previous-release
1024.09ms - 1062.84msslower ❌
2% - 7%
15.78ms - 73.87ms
slower ❌
2% - 8%
16.68ms - 74.21ms
-
lit-html-kitchen-sink

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
39.02ms - 40.75ms-unsure 🔍
-4% - +3%
-1.73ms - +1.25ms
faster ✔
9% - 15%
4.20ms - 6.82ms
tip-of-tree
tip-of-tree
38.91ms - 41.34msunsure 🔍
-3% - +4%
-1.25ms - +1.73ms
-faster ✔
8% - 15%
3.71ms - 6.83ms
previous-release
previous-release
44.42ms - 46.38msslower ❌
10% - 17%
4.20ms - 6.82ms
slower ❌
9% - 17%
3.71ms - 6.83ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
102.53ms - 110.73ms-unsure 🔍
-4% - +6%
-4.00ms - +6.34ms
unsure 🔍
-5% - +4%
-5.59ms - +4.07ms
tip-of-tree
tip-of-tree
102.31ms - 108.61msunsure 🔍
-6% - +4%
-6.34ms - +4.00ms
-unsure 🔍
-6% - +2%
-5.98ms - +2.12ms
previous-release
previous-release
104.84ms - 109.94msunsure 🔍
-4% - +5%
-4.07ms - +5.59ms
unsure 🔍
-2% - +6%
-2.12ms - +5.98ms
-

nop-update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
29.73ms - 31.52ms-unsure 🔍
-6% - +1%
-2.06ms - +0.40ms
faster ✔
10% - 17%
3.23ms - 6.33ms
tip-of-tree
tip-of-tree
30.60ms - 32.30msunsure 🔍
-1% - +7%
-0.40ms - +2.06ms
-faster ✔
7% - 15%
2.43ms - 5.48ms
previous-release
previous-release
34.14ms - 36.67msslower ❌
10% - 21%
3.23ms - 6.33ms
slower ❌
8% - 18%
2.43ms - 5.48ms
-
lit-html-repeat

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
12.71ms - 13.50ms-unsure 🔍
-4% - +5%
-0.54ms - +0.70ms
faster ✔
6% - 15%
0.84ms - 2.25ms
tip-of-tree
tip-of-tree
12.54ms - 13.51msunsure 🔍
-5% - +4%
-0.70ms - +0.54ms
-faster ✔
6% - 16%
0.87ms - 2.38ms
previous-release
previous-release
14.07ms - 15.23msslower ❌
6% - 17%
0.84ms - 2.25ms
slower ❌
6% - 19%
0.87ms - 2.38ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
326.81ms - 354.41ms-unsure 🔍
-5% - +6%
-17.99ms - +19.01ms
faster ✔
31% - 38%
159.01ms - 205.29ms
tip-of-tree
tip-of-tree
327.79ms - 352.43msunsure 🔍
-6% - +5%
-19.01ms - +17.99ms
-faster ✔
32% - 38%
160.37ms - 204.95ms
previous-release
previous-release
504.19ms - 541.34msslower ❌
45% - 62%
159.01ms - 205.29ms
slower ❌
46% - 62%
160.37ms - 204.95ms
-
lit-html-template-heavy

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
60.84ms - 63.34ms-unsure 🔍
-3% - +3%
-1.59ms - +1.79ms
faster ✔
16% - 21%
11.72ms - 16.39ms
tip-of-tree
tip-of-tree
60.86ms - 63.13msunsure 🔍
-3% - +3%
-1.79ms - +1.59ms
-faster ✔
16% - 21%
11.88ms - 16.43ms
previous-release
previous-release
74.17ms - 78.12msslower ❌
19% - 27%
11.72ms - 16.39ms
slower ❌
19% - 27%
11.88ms - 16.43ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
130.67ms - 136.42ms-unsure 🔍
-4% - +1%
-5.77ms - +1.88ms
faster ✔
12% - 17%
18.88ms - 27.60ms
tip-of-tree
tip-of-tree
132.97ms - 138.01msunsure 🔍
-1% - +4%
-1.88ms - +5.77ms
-faster ✔
11% - 16%
17.17ms - 25.43ms
previous-release
previous-release
153.51ms - 160.05msslower ❌
14% - 21%
18.88ms - 27.60ms
slower ❌
12% - 19%
17.17ms - 25.43ms
-
reactive-element-list

render

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
70.44ms - 73.62ms-unsure 🔍
-2% - +3%
-1.59ms - +2.17ms
unsure 🔍
-3% - +3%
-1.97ms - +2.28ms
tip-of-tree
tip-of-tree
70.72ms - 72.76msunsure 🔍
-3% - +2%
-2.17ms - +1.59ms
-unsure 🔍
-3% - +2%
-1.88ms - +1.61ms
previous-release
previous-release
70.46ms - 73.29msunsure 🔍
-3% - +3%
-2.28ms - +1.97ms
unsure 🔍
-2% - +3%
-1.61ms - +1.88ms
-

update

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
929.70ms - 962.65ms-unsure 🔍
-2% - +3%
-16.75ms - +26.01ms
unsure 🔍
-2% - +3%
-18.76ms - +24.61ms
tip-of-tree
tip-of-tree
927.92ms - 955.18msunsure 🔍
-3% - +2%
-26.01ms - +16.75ms
-unsure 🔍
-2% - +2%
-21.32ms - +17.91ms
previous-release
previous-release
929.15ms - 957.35msunsure 🔍
-3% - +2%
-24.61ms - +18.76ms
unsure 🔍
-2% - +2%
-17.91ms - +21.32ms
-

update-reflect

VersionAvg timevs this-change
vs tip-of-tree
tip-of-tree
vs previous-release
previous-release
this-change
1044.79ms - 1075.33ms-unsure 🔍
-1% - +3%
-10.33ms - +31.78ms
unsure 🔍
-2% - +2%
-20.47ms - +22.97ms
tip-of-tree
tip-of-tree
1034.84ms - 1063.83msunsure 🔍
-3% - +1%
-31.78ms - +10.33ms
-unsure 🔍
-3% - +1%
-30.66ms - +11.71ms
previous-release
previous-release
1043.36ms - 1074.26msunsure 🔍
-2% - +2%
-22.97ms - +20.47ms
unsure 🔍
-1% - +3%
-11.71ms - +30.66ms
-

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.

1 participant