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

Various micro optimizations of the component boot flow. #23767

Merged
merged 5 commits into from
Aug 7, 2019

Conversation

cramforce
Copy link
Member

@cramforce cramforce commented Aug 7, 2019

  • Removes unnecessary hasAttributes call from propagateAttributes
  • Bundles several classList.add operations into one.
  • Add special case for AMP Doc retrieval that is faster if no shadow doc was ever added which is common.
  • Makes hot getTopWindow function faster by ensuring the property that is rarely defined is at least known.

src/base-element.js Outdated Show resolved Hide resolved
src/custom-element.js Outdated Show resolved Hide resolved
src/custom-element.js Outdated Show resolved Hide resolved
src/service.js Outdated
return top;
}
// Make this defined but null to speed up future lookups.
win.__AMP_TOP = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

We could set this to win instead? Then keep the same ||: win.__AMP_TOP || (win.__AMP_TOP = win)

@cramforce
Copy link
Member Author

PTAL

@cramforce cramforce merged commit 6dcf87f into ampproject:master Aug 7, 2019
@cramforce cramforce deleted the make-it-fast branch August 7, 2019 21:35
thekorn pushed a commit to edelight/amphtml that referenced this pull request Sep 11, 2019
…3767)

- Removes unnecessary `hasAttributes` call from `propagateAttributes`
- Bundles several `classList.add` operations into one.
- Add special case for AMP Doc retrieval that is faster if no shadow doc was ever added which is common.
- Makes hot `getTopWindow` function faster by ensuring the property that is rarely defined is at least known.
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.

4 participants