Skip to content

Various micro optimizations of the component boot flow.#23767

Merged
cramforce merged 5 commits intoampproject:masterfrom
cramforce:make-it-fast
Aug 7, 2019
Merged

Various micro optimizations of the component boot flow.#23767
cramforce merged 5 commits intoampproject:masterfrom
cramforce:make-it-fast

Conversation

@cramforce
Copy link
Copy Markdown
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.

@cramforce cramforce force-pushed the make-it-fast branch 2 times, most recently from 701b0ab to 2384159 Compare August 7, 2019 04:32
@cramforce cramforce requested a review from jridgewell August 7, 2019 04:38
src/service.js Outdated
return top;
}
// Make this defined but null to speed up future lookups.
win.__AMP_TOP = null;
Copy link
Copy Markdown
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
Copy Markdown
Member Author

PTAL

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