jQuery body vs. document.body selector

JavaScript performance comparison

Revision 46 of this test case created by Baine

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
$('body').width()
$('body').width();
pending…
document.body.clientWidth
document.body.clientWidth;
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL.

1 Comment

Baine (revision owner) commented :

jQuery is still overbloated and sucks, all it does is rewrite, methods that are already available, except it does even if your not going to use it. Why reload the whole body element into jquery memory and then play with it, it's already there, just use the method that are included with it. jQuery dom selection methods? document.querySelectorAll