3 ms·
I think what you're referring to is that querySelector is O(n), while the older getElement APIs are O(1). https://stackoverflow.com/questions/14377590/querysel
by chubot 6y ago
I think what you're referring to is that querySelector is O(n), while the older getElement APIs are O(1).
https://stackoverflow.com/questions/14377590/queryselector-and-queryselectorall-vs-getelementsbyclassname-and-getelementbyid/54819633#54819633 https://stackoverflow.com/questions/14377590/queryselector-a...
That makes sense, but it has nothing to do with "string parsing", as the OP said. Parsing the query is fast. Executing the query is slow, because it's a more general API.
(And this is why the citation is important: because it shows the real issue, not the one described! Thanks for the clarification.)
- austincheney 6y agoSee this: https://news.ycombinator.com/item?id=24058409 https://news.ycombinator.com/item?id=24058409