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

core(perf): speed up getNodePath #9055

Merged
merged 1 commit into from
May 28, 2019
Merged

core(perf): speed up getNodePath #9055

merged 1 commit into from
May 28, 2019

Conversation

paulirish
Copy link
Member

@paulirish paulirish commented May 25, 2019

this makes it ~20% faster.

to benchmark...

  1. go to https://en.wikipedia.org/w/index.php?title=List_of_2017_albums&oldid=881381189
  2. evaluate the getNodePath function
  3. evaluate this:
els = Array.from(document.querySelectorAll('*')); 

console.time('hi'); 
els.forEach(getNodePath); 
console.timeEnd('hi');

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

LGTM!

For others, https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue was helpful in validating myself on what nodeValue invariants there are :)

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.

2 participants