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

Revisit caching of attribute values #3732

Closed
Rich-Harris opened this issue Oct 18, 2019 · 2 comments
Closed

Revisit caching of attribute values #3732

Rich-Harris opened this issue Oct 18, 2019 · 2 comments
Labels

Comments

@Rich-Harris
Copy link
Member

Describe the bug
#3723 causes a performance regression — the getAttribute is too costly, it turns out. Man, the DOM sucks.

Severity
Needs to get fixed before the next stable

Additional context
Since #3579 was directed at solving a specific case, maybe we could just address that case directly — i.e. treat hydration differently

@mrkishi
Copy link
Member

mrkishi commented Oct 18, 2019

Since template values are already checked for changes on runtime, I don't think attr really needs that check and the simplest solution would be to just move it to h().

I wonder if we could pull off skipping h altogether?

const target = document.body;
const props = { a: 1, b: 2 };

const { head, html, css, uuid } = ServerComponent.render(props);
// first element: <tag data-svelte-uuid=1231>

target.innerHTML = html;

// we use `uuid` when we know props is the same
const component = new ClientComponent({ target, hydrate: true, props, uuid });

/*
    l(nodes) {
        tag = claim_element(nodes, "tag", { uuid: true }, false);
        ...
        if (tag.dataset.svelteUuid !== uuid) this.h();
    }
*/

Rich-Harris added a commit that referenced this issue Nov 9, 2019
revert #3723, add special case for src attributes
@benmccann benmccann changed the title Revist #3723 Revisit caching of attribute values Sep 9, 2020
@benmccann
Copy link
Member

It looks like this was addressed awhile back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants