I tested the differences between 2 ID selectors, the first is normal : $('#lol')
And the second is the same but placed between multiple parenthesis : $((((('#lol')))))
I launched a test on jsperf, with firefox and chrome. Results are interesting : With firefox, the first (normal selector) is 40% slower (!!!). With chrome, the second is 0.84% slower.
Why such a difference ? Can someone explain this ?
Is jsperf.com reliable ?
You can see the test here :
I will test on others browsers, for fun.
(Edit: i'm on Mac OS X, by the way)
.html()
if you want to test$()
? The.html()
call will completely eclipse any differences, if there was any. – Hillegass