Zepto vs. jQ vs. raw JS Dom (v67)

Revision 67 of this benchmark created on


Description

Zepto vs. Jquery vs. raw JS for getting an element by id

Preparation HTML

<script src="//zeptojs.com/zepto.min.js">
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id="asdf">
</div>

Setup

function el(string) {
      if (string.indexOf('#') === 0) {
        return document.getElementById(string.substr(1, string.length));
      }
    }
    
    //to be fair, I'll wrap getElementById in a function and return the object
    
    
    function byId(id) {
      return document.getElementById(id);
    }
    
    var boolean = true;

Test runner

Ready to run.

Testing in
TestOps/sec
Zepto
Zepto('#asdf')
ready
Jquery
jQuery('#asdf')
ready
Raw/baseline
byId('asdf')
ready
Wrapped Raw
el('#asdf')
ready
Straight getElementById
document.getElementById('asdf')
ready

Revisions

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