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 src="https://raw.github.com/gist/568b21bbea4349d59833/qs.js"></script>
<script>
var fns = {}
function Fn(s) {
if (s in fns) return fns[s]
var a = ["_"]
, t = s.split("->")
if (t.length > 1) while (t.length) {
s = t.pop()
a = t.pop().match(/\w+/g)||""
t.length && t.push("(function("+a+"){return("+s+")})")
}
return fns[s] = new Function(a, "return(" + s + ")")
}
String.prototype.fn = function() {
return Fn(this)
}
var el_re = /([.#:])([-\w]+)/g
function my_find(sel) {
var rules = ["_"]
, tag = sel.replace(el_re, function(_, o, s) {
rules.push( o == "." ? "(' '+_.className+' ').indexOf(' "+s+" ')>-1" : o == "#" ? "_.id=='"+s+"'" : "_."+s );
return "";
}) || "*"
, fn = rules.join("&&").fn()
, el
, els = document.getElementsByTagName(tag)
, i = 0;
while (el = els[i++]) if (fn(el)) return el;
}
</script>
<div></div>
<div id="foo"></div>
<div class="bar"></div>
Ready to run.
Test | Ops/sec | |
---|---|---|
getElementsBy |
| ready |
querySelectorAll |
| ready |
jQuery |
| ready |
qs |
| ready |
my_find |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.