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
<div id="div"></div>
<script>
var div = document.getElementById('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];
}
};
}();
</script>
div.setAttribute('data-attr-yo', 'yo');
div.setAttribute('data-attr-ma', 'ma');
div.setAttribute('data-attr-la', 'la');
Data.set(div, {yo: 'yo', ma: 'ma', la: 'la'});
div.dataset = {yo: 'yo', ma: 'ma', la: 'la'};
div.setAttribute('data-yo', null);
div.setAttribute('data-ma', null);
div.setAttribute('data-la', null);
div.setAttribute('__data', null);
Data.reset();
Ready to run.
Test | Ops/sec | |
---|---|---|
setAttribute |
| ready |
Data |
| ready |
dataset |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.