-
Notifications
You must be signed in to change notification settings - Fork 370
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
Should browsers do bookkeeping on DOM parts after initial parse? #1030
Comments
What kind of bookkeepings are there? |
Consider the following test case.
I personally would be ok with the last assertion to be 0. |
Why is supporting getParts() to be updated so expensive? It seems like an implementation problem to me. |
We’re going to look into seeing if we’re doing anything egregious. I guess
if we’re using ChildNodePart.replaceChildren with a document fragment, the
operation to update parts should be pretty cheap.
I was thinking with a normal dom element, you’d have to track its owner
part and move the related parts accordingly, but we’re not exactly doing
that.
…On Fri, Sep 15, 2023 at 12:49 PM Ryosuke Niwa ***@***.***> wrote:
Why is supporting getParts() to be updated so expensive? It seems like an
implementation problem to me.
—
Reply to this email directly, view it on GitHub
<#1030 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2MCG4HSHW2E25UIAWDYWDX2QXEHANCNFSM6AAAAAA4ZR4NWQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I tend to agree - I’d refrain from making API decisions too early based on the early prototype. I haven’t had much time to optimize and it’s likely there’s something easy that could be fixed in replaceChildren. That said, it’d be good to have the debate about whether tracking is necessary, because it certainly has non-zero overhead. Removing it will make the basic operations faster. But I don’t know if removing it will make the usage of the API faster, since it might require more work to be done on the framework side. |
If bookkeeping does end up being irreducibly expensive, I was definitely partial to the |
Mason fixed up my benchmark a little bit, so now we're a little bit better with DOM parts being about 1.3x slower (can definitely be investigated further). See https://playcode.io/1595899 |
…is actively being investigated further… |
See preliminary benchmark in https://playcode.io/1595899 using chrome-dev with experimental platform features on.
My numbers appear to be
cloning
8.100000023841858
getParts
1.5000000447034836
accessNodes
1.0999999791383743
operations
1.800000011920929
replaceChildren
30.5
As you can see, there is huge overhead in replaceChildren, presumably to do bookkeeping on keeping the parts up to date. Given how we expect users to use DOM parts in frameworks, we should think about whether bookkeeping is necesary in v1.
The text was updated successfully, but these errors were encountered: