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

Revision 27 of this benchmark created by Devin on


Preparation HTML

<script src="https://staging-ian.appmobi.com/game/zepto.min.js">
</script>
<script src="https://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
Jquery
$('#asdf')
ready
Zepto
$('#asdf')
ready
Raw/baseline
byId('asdf')
ready
Straight getElementById
document.getElementById('asdf')
ready
Wrapped Raw
el('#asdf')
ready

Revisions

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