getElementById

JavaScript performance comparison

Test case created by James Charlesworth

Info

testing document.getElementById vs $('#') if jquery is loaded

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="content">Some content</div>

Preparation code output

Some content

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
getElementById
var content = document.getElementById('content');
pending…
$('#')
var content = $('#content')
pending…

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

Compare results of other browsers

0 comments

Add a comment