jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
In our test, we will create a div with a class of foo, and an id of "child" plus an iterator, i. We will append this new div to a div in our document.body with an id of target, and give it an innerHTML of "child" plus i.
<div id="target"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="//kzyp.dojotoolkit.org/packages/put-selector/put.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.8.1/dojo/dojo.js" data-dojo-config="async: true"></script>
<script>
require(["dojo/dom-construct"]); // require for later use
</script>
var target = document.getElementById("target"); // as same code for target for consistency
var domConstruct = require("dojo/dom-construct");
var $target = jQuery(target); // cache jQuery target
var i = 0;
domConstruct.empty(target);
Ready to run.
Test | Ops/sec | |
---|---|---|
put-selector put |
| ready |
dom-construct place |
| ready |
dom-construct create |
| ready |
jQuery append |
| ready |
jQuery appendTo |
| ready |
jQuery appendTo (create) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.