getElementById VS jQuery('#id')
JavaScript performance comparison
Preparation code
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">
</script>
<p id="foo">
Test
</p>
<p id="bar">
bars</p>
Preparation code output
Test
bars
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
getElementById |
|
pending… |
jQuery Selector |
|
pending… |
Custom Method |
|
pending… |
$ Custom Method |
|
pending… |
jQuery Window Object |
|
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. Here’s a list of current revisions for this page:
- Revision 1: published
- Revision 2: published
- Revision 3: published
- Revision 4: published
- Revision 5: published
- Revision 6: published
- Revision 7: published
- Revision 8: published
- Revision 9: published
- Revision 10: published
- Revision 11: published by Onigoetz
- Revision 12: published
- Revision 13: published
- Revision 14: published
- Revision 15: published by Jennifer Simonds
- Revision 16: published
- Revision 17: published
- Revision 20: published by Goonoo Kim
- Revision 21: published
- Revision 22: published
- Revision 23: published
- Revision 24: published
- Revision 25: published by tester obj
- Revision 26: published by Dan Lee
- Revision 27: published
- Revision 29: published
- Revision 30: published by Jason
- Revision 31: published by Marcin
- Revision 32: published
- Revision 33: published
- Revision 35: published
- Revision 36: published by rein
- Revision 38: published by aaronlks
- Revision 39: published
- Revision 40: published
- Revision 41: published
- Revision 42: published
- Revision 43: published
- Revision 44: published
- Revision 45: published
- Revision 46: published
- Revision 47: published
- Revision 48: published
0 comments