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><div>
<ul>
<li><input></li>
<li><input></li>
<li><input></li>
</ul>
<ul>
<li><input></li>
<li><input></li>
<li><input></li>
</ul>
<ul>
<li><input></li>
<li><input></li>
<li><input></li>
</ul>
<ul>
<li><input></li>
<li><input></li>
<li><input></li>
</ul>
<ul>
<li><input></li>
<li><input></li>
<li><input></li>
</ul>
<ul>
<li><input></li>
<li><input></li>
<li><input></li>
</ul>
</div>
<script>
var i, len, $$ = (function(a) {
var doc = document;
return function(b, ctx) {
var e;
if (ctx && typeof ctx === "object" && typeof b === "string") {
a[0] = ctx;
e = a.find("[id=" + b + "]").get(0);
}
if (typeof b === "string" && !e) {
e = doc.getElementById(b);
}
if (typeof b === "object") {
a[0] = e = b;
}
if (e === null) {
e = doc.getElementsByName(b);
a[0] = e[0] ? e[0] : e;
} else {
a[0] = e;
}
return a;
};
}(jQuery([1])));
(function($) {
// https://gist.github.com/938767
var detach = $.detach = function(node, async, fn) {
var parent = node.parentNode;
var next = node.nextSibling;
// No parent node? Abort!
if (!parent) {
return;
}
// Detach node from DOM.
parent.removeChild(node);
// Handle case where optional `async` argument is omitted.
if (typeof async != 'boolean') {
fn = async;
async = false;
}
// Note that if a function wasn't passed, the node won't be re-attached!
if (fn && async) {
// If async == true, reattach must be called manually.
fn.call(node, reattach);
} else if (fn) {
// If async != true, reattach will happen automatically.
fn.call(node);
reattach();
}
// Re-attach node to DOM.
function reattach() {
parent.insertBefore(node, next);
}
};
// Override the default .detach method to offer the new functionality.
$.fn.detach = function(async, fn) {
return this.each(function() {
// Call detach for each element in the collection.
detach(this, async, fn);
});
};
})(jQuery);
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
jQuery |
| ready |
For |
| ready |
jQuery with Singleton |
| ready |
For with Singelton |
| ready |
While |
| ready |
While with Singleton |
| ready |
jQuery without Sizzle |
| ready |
jQuery fastDetach |
| ready |
jQuery fastDetach with Singleton |
| ready |
jQuery fastDetach parent with Singelton |
| ready |
jQuery fastDetach parent less Sizzle |
| ready |
jQuery fastDetach parent no Sizzle |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.