3 ms·
I was curious about the speed of jQuery selector versus querySelectorAll so I made a jsperf test. I realized people have done it already when trying to select
by scragg 14y ago
I was curious about the speed of jQuery selector versus querySelectorAll so I made a jsperf test. I realized people have done it already when trying to select a slug. When looking at the results, I noticed opera having a massive edge over the rest so I assumed it was doing some caching. Therefore, I created a random DOM for each test using the setup/teardown.
http://jsperf.com/jquery-vs-queryselectorall-scragg http://jsperf.com/jquery-vs-queryselectorall-scragg
- jgalt212 14y agoyour results confirmed what I suspected, that using jQuery selectors is both performant and readable code. Ergo, his second point is probably advice best ignored. His appoint about using document fragments, or some equivalent thereof that resides outside the main DOM, is a good practice to follow when there are a large number of serial changes to the DOM that in effect are only one change to the user.