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
Compare perf when getting an element by id with Dojo, jQuery, ExtJS, My.js, native implementation and native implementation with cache.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.7.0/dojo/dojo.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/ext-core/3.1.0/ext-core.js"></script>
<script type="text/javascript" src="http://myjs.fr/0.1.2/my.js"></script>
<script type="text/javascript" src="http://yass.webo.in/yass.0.3.9.min.js"></script>
<div id='test'></div>
<script>
(function(obj) {
var cache = {};
obj.getEBI = function(id) {
var c = cache[id];
if (!c) cache[id] = c = document.getElementById(id);
return c;
};
})(window);
(function(obj) {
var cache = {};
obj.$yas= function(id) {
var c = cache[id];
if (!c) cache[id] = c = _(id);
return c;
};
})(window);
(function($){
var rId = /(?=^#[\w\-]+$)/, safe = $, cache= {}, toString = String.prototype.toString;
this.jqCached = function jq(id){
return cache[id] || (rId.test(toString.call(id)) && (cache[id]=safe(document.getElementById(id.substring(1))))) || safe.apply(this, arguments);
};
this.jqUncached = function jq(id){
return rId.test(toString.call(id)) && safe(document.getElementById(id.substring(1))) || safe.apply(this, arguments);
};
}).call(window, jQuery);
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
jQuery |
| ready |
Dojo |
| ready |
ExtJS |
| ready |
My.js |
| ready |
Native |
| ready |
Native (cached) |
| ready |
Yass |
| ready |
Yass (cached) |
| ready |
jQuery (enhanced, uncached) |
| ready |
jQuery (cached) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.