question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

QuerySelectorAll - performance

See original GitHub issue

I try to profile my app because i facing issue with performance (main reason why i recently switch from HAP). And i notice NodeList.get_Length() in QuerySelectorAll is take lot of time (almost 10%). Of course it depend on how much elements is in collection).

I want to try rewrite it with my custom QuerySelectorAll but i end with too many class is need to rewrite. Maybe you can try just save elements.Length to local variable it should get some percent of performance in this highly used function.

image

Testing with last stable version 0.9.9 but from first look at dev branch i think it is same in 0.1.0. VS 2017 - release mode of course

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
FlorianRapplcommented, Jul 14, 2017

Great, thanks!

0reactions
jirisykora83commented, Jul 14, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

Performance tradeoffs of querySelector and querySelectorAll
querySelector and querySelectorAll are both slower than other functions for accessing the DOM when they are first called; although querySelector ...
Read more >
Performance - querySelectorAll()
One potential performance issue with using querySelectorAll() is that it can be computationally expensive to search for elements on a page using a...
Read more >
Performance using JS querySelector [closed]
Firstly, document.querySelector("#elem");. Has an advantage in the fact that, unlike document.getElementId, it can return classes.
Read more >
Benchmark: querySelector vs querySelectorAll vs ...
Comparing performance of: querySelector vs querySelectorAll vs getElementsByClassName vs querySelector (ID) vs getElementsByID.
Read more >
JavaScript Selector Performance
getElementById() can run about 15 million operations a second, compared to just 7 million per second for querySelector() in the latest version ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found