3 ms·
The SO thread in question is this one: http://stackoverflow.com/q/4837876/172322 http://stackoverflow.com/q/4837876/172322 The accepted answer has correct opti
by yahelc 16y ago
The SO thread in question is this one: http://stackoverflow.com/q/4837876/172322 http://stackoverflow.com/q/4837876/172322
The accepted answer has correct options, but its inaccurately suggesting that the Sizzle selectors are faster. I setup this JSPerf test to prove that Sizzle is least efficient, and that in fact the OP's version seems to be THE fastest across all the browsers. The more data points I can gather, the more effectively I'll be able to rebut that the conventional wisdom here is wrong.
- mdg 16y agoThat person had "should" italicized. Also, the question is asking what the most elegant solution would be, not the most fast.
- yahelc 16y agoTotally. I don't think the Accepted Answer should be downvoted (since its rigorous and not intentionally misleading), but merely that there should be data to back-up the claims (and the 'Accepted Answer' he links to doesn't provide supporting evidence). This is how bad information is spread. Also, I'm arguing that performance "should" be trumped by elegance if the performance differences are so significant.
- timrobinson 16y agoThe answer just states that "it has been hypothesized", so technically it's correct. It doesn't claim whether this is true; the answerer needs "a reliable cross-browser, multi-document benchmark" in order to do that. Besides, if I worried about every wrong-yet-accepted answer on StackOverflow, I'd be quite worried by now.
- yahelc 16y agoYes, I guess I could say "it has been hypothesized that the world was created in 6 days 5,000 years ago", and I wouldn't be wrong :) Inaccurate-yet-accepted with 0-2 upvotes: Not damaging. Inaccurate-yet-accepted with 25 upvotes: Has the potential to widely perpetuate false beliefs.