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="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script>
/*
dollarDom jQuery Plugin v2.0
Copyright 2011 Robert Messerle
Site: http://dollardom.robertmesserle.com/
*/
(function($) {
$.dom = function(str, obj, attr) {
var tag = str.match(/^[\w\d]+/i)[0],
classes = str.match(/\.[\w\d\-\_]+/gi),
id = str.match(/\#[\w\d\-\_]+/),
attrs = str.match(/\[[\"\']?[\w\d\-\_]+[\"\']?\=[\"\']?[^\"\'\]]+[\"\']?\]/gi),
elem = document.createElement(tag),
$elem = $(elem),
i;
if (classes) elem.className = classes.join('').substring(1).replace(/\./g, ' ');
if (id && id[0]) elem.id = id[0].substring(1);
if (attrs) setAttributes(elem, attrs);
if (attr) setAttributes(elem, attr);
if (obj) for (i in obj) if ($elem[i]) $elem[i](obj[i]);
return $elem;
};
function setAttributes(elem, attrs) {
var len, split;
if (attrs instanceof Array && (len = attrs.length)) {
while (len--) {
split = attrs[len].split(/[\[\]\=]/g);
setAttribute(elem, split[1], split[2]);
}
} else {
for (var i in attrs) setAttribute(elem, i, attrs[i]);
}
}
function setAttribute(elem, key, value) {
if (key === 'class') elem.className = value;
else elem.setAttribute(key, value);
}
})(jQuery);
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
jQuery |
| ready |
dollarDom |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.