QuerySelectorAll - performance
See original GitHub issueI 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.
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:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Great, thanks!
Ok here is the gist.
https://gist.github.com/jirisykora83/d1316a636d5f6c154872cc746c7654a1