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
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<div id="mydiv"></div>
var div = document.getElementById('mydiv');
var $div = $(div);
var Data = function() {
var warehouse = {};
var count = 1;
return {
reset: function() {
count = 1;
warehouse = {};
},
set: function (dom, data) {
if (!dom.__data) {
dom.__data = "hello" + count++;
}
warehouse[dom.__data] = data;
},
get: function(dom) {
return warehouse[dom.__data];
}
};
}();
div.setAttribute('data-po', null);
div.setAttribute('data-ta', null);
div.setAttribute('data-to', null);
div.setAttribute('__data', null);
Data.reset();
$div.removeData();
Ready to run.
Test | Ops/sec | |
---|---|---|
old school setAttribute |
| ready |
DIY Data |
| ready |
HTML5 dataset |
| ready |
jQuery data() |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.