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.
Re:There are 25 votes for an inaccurate SO answer. Help me p...
by timrobinson on Thursday February 03, 2011 @12:00PM
(#2175463)
The 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.
Re:There are 25 votes for an inaccurate SO answer. Help me p...
by yahelc on Thursday February 03, 2011 @11:56AM
(#2175443)
Totally. 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.
Re:There are 25 votes for an inaccurate SO answer. Help me p...
by piers on Thursday February 03, 2011 @12:26PM
(#2175573)
Slightly OT, but is it really that difficult to tell the difference between Windows Server 2008R2 and Windows 7? The linked page doesn't seem to be able to tell the difference between the two.
Re:There are 25 votes for an inaccurate SO answer. Help me p...
by mathias on Thursday February 03, 2011 @02:30PM
(#2176351)
Hey, I’m the guy who made the jsPerf website.
The product token for Windows Server 2008R2 and Windows 7 is the same (6.1) so there’s technically no way to tell the difference. jsPerf is supposed to show you it could be both, not one of them. Is this bugged?
Re:There are 25 votes for an inaccurate SO answer. Help me p...
by jdd on Thursday February 03, 2011 @04:36PM
(#2176979)
It's something like say your slow value was 25 ops/sec and your fast value was 100 ops/sec, then do (1 - 25 / 100) = 0.75. So as a percent 25 ops/sec is 75% slower than 100 ops/sec.
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.
Besides, if I worried about every wrong-yet-accepted answer on StackOverflow, I'd be quite worried by now.
Inaccurate-yet-accepted with 0-2 upvotes: Not damaging.
Inaccurate-yet-accepted with 25 upvotes: Has the potential to widely perpetuate false beliefs.
Also, I'm arguing that performance "should" be trumped by elegance if the performance differences are so significant.
The product token for Windows Server 2008R2 and Windows 7 is the same (6.1) so there’s technically no way to tell the difference. jsPerf is supposed to show you it could be both, not one of them. Is this bugged?
OT, but, is there any way to embed the results dynamically?
Could you not do something with the user agent or do you get that already?
Here is a MSDN post that examines some of the platform tokens http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
Regardless, there's an edit with a correction now.