Skip to content

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');

@paulirish paulirish requested a review from brendankenny as a code owner May 25, 2019 00:26
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