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
Selectors test of 7 useful javascript frameworks
<script src="//xui-js.googlecode.com/files/xui-core-1.0.0.js"></script>
<script src="//jamesdonaghue.com/static/peppy/peppy-min.js"></script>
<script src="//www.midorijs.com/midori.js"></script>
<script src="//yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
<script src="//yui.yahooapis.com/3.4.1/build/selector/selector-min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script>var j4 = jQuery.noConflict();</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.2/jquery.min.js"></script>
<script>var j2 = jQuery.noConflict();</script>
<script src="//linkedin.com/lib/sizzle/1.0/sizzle.js"></script>
<script src="http://code.jquery.com/jquery-1.7.min.js"></script>
<script>var j17 = jQuery.noConflict();</script>
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"></script>
<script type='text/javascript'>
/*!
* Qwery - A Blazing Fast query selector engine
* https://github.com/ded/qwery
* copyright Dustin Diaz & Jacob Thornton 2011
* MIT License
*/
!function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&typeof define.amd=="object"?define(b):this[a]=b()}("qwery",function(){function X(a,c){return function(d){var e,f;p.test(d)?a!==b&&((f=e=a.getAttribute("id"))||a.setAttribute("id",f="__qwerymeupscotty"),d="#"+f+d,c(b,d),e||a.removeAttribute("id")):d.length&&c(a,d)}}function W(a,c){var d,h,i=V(c);if(!i||!a)return[];if(a===window||S(a))return!c||a!==window&&S(i)&&Y(a,i)?[a]:[];if(a&&U(a))return I(a);if(d=a.match(o)){if(d[1])return(h=b[g](d[1]))?[h]:[];if(d[2])return J(i[f](d[2]));if($&&d[3])return J(i[e](d[3]))}return _(a,i)}function V(a){if(!a)return b;if(typeof a=="string")return W(a)[0];if(U(a))return a[0];return a}function U(a){return typeof a=="object"&&isFinite(a.length)}function T(a){var b=[],c,d;label:for(c=0;c<a.length;c++){for(d=0;d<b.length;d++)if(b[d]==a[c])continue label;b[b.length]=a[c]}return b}function S(a){return a&&typeof a=="object"&&a.nodeType&&(a.nodeType==1||a.nodeType==9)}function R(a,b,c,d){function f(a,d,g){while(g=A[c[d]](g,a))if(S(g)&&(found=M.apply(g,L(b[d])))){if(!d)return g;if(e=f(g,d-1,g))return e}}var e;return(e=f(a,b.length-1,a))&&(!d||Y(e,d))}function Q(a,b,c){if(S(b))return a==b;if(U(b))return!!~I(b).indexOf(a);var d=b.split(","),e,f;while(b=d.pop()){e=F.g(b)||F.s(b,b.split(y)),f=b.match(x),e=e.slice(0);if(M.apply(a,L(e.pop()))&&(!e.length||R(a,e,f,c)))return!0}}function P(a){var c=[],d=[],e,h,i,j,l,m,n,o,p,q=F.g(a)||F.s(a,a.split(y)),r=a.match(x);if(!q.length)return c;q=q.slice(0),j=q.pop(),n=q.length&&(i=q[q.length-1].match(k))?b[g](i[1]):b;if(!n)return c;o=L(j),m=n.nodeType!==9&&r&&/^[+~]$/.test(r[r.length-1])?function(a){while(n=n.nextSibling)n.nodeType==1&&(o[1]?o[1]==n.tagName.toLowerCase():1)&&(a[a.length]=n);return a}([]):n[f](o[1]||"*");for(e=0,h=m.length;e<h;e++)if(p=M.apply(m[e],o))c[c.length]=p;if(!q.length)return c;H(c,function(a){R(a,q,r)&&(d[d.length]=a)});return d}function O(a,b,c){switch(a){case"=":return b==c;case"^=":return b.match(E.g("^="+c)||E.s("^="+c,new RegExp("^"+N(c))));case"$=":return b.match(E.g("$="+c)||E.s("$="+c,new RegExp(N(c)+"$")));case"*=":return b.match(E.g(c)||E.s(c,new RegExp(N(c))));case"~=":return b.match(E.g("~="+c)||E.s("~="+c,new RegExp("(?:^|\\s+)"+N(c)+"(?:\\s+|$)")));case"|=":return b.match(E.g("|="+c)||E.s("|="+c,new RegExp("^"+N(c)+"(-|$)")))}return 0}function N(a){return D.g(a)||D.s(a,a.replace(t,"\\$1"))}function M(a,b,c,d,e,f,g,h,k,l,m){var n,o,p,q,r;if(b&&this.tagName.toLowerCase()!==b)return!1;if(c&&(o=c.match(i))&&o[1]!==this.id)return!1;if(c&&(r=c.match(j)))for(n=r.length;n--;)if(!G(r[n].slice(1)).test(this.className))return!1;if(k&&W.pseudos[k]&&!W.pseudos[k](this,m))return!1;if(d&&!g){q=this.attributes;for(p in q)if(Object.prototype.hasOwnProperty.call(q,p)&&(q[p].name||p)==e)return this}if(d&&!O(f,Z(this,e)||"",g))return!1;return this}function L(a){return a.match(z)}function K(a){while(a=a.previousSibling)if(a.nodeType==1)break;return a}function J(a){var b=0,c=a.length,d=[];for(;b<c;b++)d[b]=a[b];return d}function I(a){var b=[];H(a,function(a){U(a)?b=b.concat(a):b[b.length]=a});return b}function H(a,b){var c=0,d=a.length;for(;c<d;c++)b.call(null,a[c])}function G(a){return C.g(a)||C.s(a,new RegExp("(^|\\s+)"+a+"(\\s+|$)"))}function B(){this.c={}}var a=this,b=document,c=a.qwery,d=b.documentElement,e="getElementsByClassName",f="getElementsByTagName",g="getElementById",h="querySelectorAll",i=/#([\w\-]+)/,j=/\.[\w\-]+/g,k=/^#([\w\-]+)$/,l=/^\.([\w\-]+)$/,m=/^([\w\-]+)$/,n=/^([\w]+)?\.([\w\-]+)$/,o=new RegExp(k.source+"|"+m.source+"|"+l.source),p=/(^|,)\s*[>~+]/,q=/^\s+|\s*([,\s\+\~>]|$)\s*/g,r=/[\s\>\+\~]/,s=/(?![\s\w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^'"]*\]|[\s\w\+\-]*\))/,t=/([.*+?\^=!:${}()|\[\]\/\\])/g,u=/^([a-z0-9]+)?(?:([\.\#]+[\w\-\.#]+)?)/,v=/\[([\w\-]+)(?:([\|\^\$\*\~]?\=)['"]?([ \w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^]+)["']?)?\]/,w=/:([\w\-]+)(\(['"]?([\s\w\+\-]+)['"]?\))?/,x=new RegExp("("+r.source+")"+s.source,"g"),y=new RegExp(r.source+s.source),z=new RegExp(u.source+"("+v.source+")?"+"("+w.source+")?"),A={" ":function(a){return a&&a!==d&&a.parentNode},">":function(a,b){return a&&a.parentNode==b.parentNode&&a.parentNode},"~":function(a){return a&&a.previousSibling},"+":function(a,b,c,d){if(!a)return!1;return(c=K(a))&&(d=K(b))&&c==d&&c}};B.prototype={g:function(a){return this.c[a]||undefined},s:function(a,b){return this.c[a]=b}};var C=new B,D=new B,E=new B,F=new B,Y="compareDocumentPosition"in d?function(a,b){return(b.compareDocumentPosition(a)&16)==16}:"contains"in d?function(a,c){c=c==b||c==window?d:c;return c!==a&&c.contains(a)}:function(a,b){while(a=a.parentNode)if(a===b)return 1;return 0},Z=function(){var a=b.createElement("p");return(a.innerHTML='<a href="#x">x</a>')&&a.firstChild.getAttribute("href")!="#x"?function(a,b){return b==="class"?a.className:b==="href"||b==="src"?a.getAttribute(b,2):a.getAttribute(b)}:function(a,b){return a.getAttribute(b)}}(),$=function(){try{return b[e]&&b.querySelector&&b[h]&&b[h](":nth-of-type(1)").length}catch(a){return!1}}(),_=$?function(a,c){var d=[],e,f;if(c===b||!p.test(a))return J(c[h](a));H(e=a.split(","),X(c,function(a,b){f=a[h](b),f.length==1?d[d.length]=f.item(0):f.length&&(d=d.concat(J(f)))}));return e.length>1&&d.length>1?T(d):d}:function(a,c){var d=[],e,g,i,j,k;a=a.replace(q,"$1");if(e=a.match(n)){if(c[h])return J(c[h](a));j=G(e[2]),items=c[f](e[1]||"*");for(g=0,i=items.length;g<i;g++)j.test(items[g].className)&&(d[d.length]=items[g]);return d}H(k=a.split(","),X(c,function(a,e){var f=0,g=P(e),h=g.length;for(;f<h;f++)if(a===b||Y(g[f],c))d[d.length]=g[f]}));return k.length>1&&d.length>1?T(d):d};W.uniq=T,W.is=Q,W.pseudos={},W.noConflict=function(){a.qwery=c;return this};return W})
</script>
<script type='text/javascript'>
(function(){var o=this,l=this.document,h=function(a){for(;(a=a.nextSibling)&&a.nodeType!==1;);return a},i=function(a){for(;(a=a.previousSibling)&&a.nodeType!==1;);return a},q=function(a){if(!a)return a;var b=a[0];return b==='"'||b==="'"?a.slice(1,-1):a},p=function(a,b){var c=a.replace(/\s+/g,""),d,f;c==="even"?c="2n+0":c==="odd"?c="2n+1":~c.indexOf("n")||(c="0n"+c);c=/^([+-])?(\d+)?n([+-])?(\d+)?$/.exec(c);d=c[1]==="-"?-(c[2]||1):+(c[2]||1);f=c[4]?c[3]==="-"?-c[4]:+c[4]:0;a=c=null;return function(a){if(a.parentNode.nodeType===
1){var c=0,e;e=a.parentNode;if(e=e.firstChild)for(;e.nodeType!==1&&(e=e.nextSibling););for(;e;){b(e,a)&&c++;if(e===a)return a=c-f,!d?!a:!(a%d);e=h(e)}}}},e={"*":function(){return true},type:function(a){a=a.toLowerCase();return function(b){return b.nodeName.toLowerCase()===a}},attr:function(a,b,c){b=r[b];return function(d){switch(a){case "for":d=d.htmlFor;break;case "class":d=d.className;break;case "href":d=d.getAttribute("href",2);break;default:d=d[a]!=null?d[a]:d.getAttribute(a)}return d!=null&&
b(d+"",c)}},":first-child":function(a){return!i(a)&&a.parentNode.nodeType===1},":last-child":function(a){return!h(a)&&a.parentNode.nodeType===1},":only-child":function(a){return!i(a)&&!h(a)&&a.parentNode.nodeType===1},":nth-child":function(a){return p(a,function(){return true})},":root":function(a){return a.ownerDocument.documentElement===a},":empty":function(a){return!a.firstChild},":not":function(a){var b=k(a);return function(a){return!b(a)}},":first-of-type":function(a){if(a.parentNode.nodeType===
1){for(var b=a.nodeName;a=i(a);)if(a.nodeName===b)return;return true}},":last-of-type":function(a){if(a.parentNode.nodeType===1){for(var b=a.nodeName;a=h(a);)if(a.nodeName===b)return;return true}},":only-of-type":function(a){return e[":first-of-type"](a)&&e[":last-of-type"](a)},":nth-of-type":function(a){return p(a,function(a,c){return a.nodeName===c.nodeName})},":checked":function(a){return!(!a.checked&&!a.selected)},":indeterminate":function(a){return!e[":checked"](a)},":enabled":function(a){return!a.disabled},
":disabled":function(a){return!!a.disabled},":target":function(a){return a.id===o.location.hash.substring(1)},":focus":function(a){return a===a.ownerDocument.activeElement},":matches":function(a){var b=k(a);return function(a){return b(a)}},":nth-match":function(a){var b=a.split(/\s*,\s*/),a=b.pop(),b=k(b.join(","));return p(a,b)},":links-here":function(a){return a+""===o.location+""}},r={"-":function(){return true},"=":function(a,b){return a===b},"*=":function(a,b){return a.indexOf(b)!==-1},"~=":function(a,
b){var c=a.indexOf(b);if(c!==-1){var d=a[c-1],c=a[c+b.length];return d===" "&&!c||!d&&c===" "||!d&&!c}},"|=":function(a,b){var c=a.indexOf(b);if(c===0)return c=a[c+b.length],c==="-"||!c},"^=":function(a,b){return a.indexOf(b)===0},"$=":function(a,b){return a.indexOf(b)+b.length===a.length}},m={" ":function(a){return function(b){for(;b=b.parentNode;)if(a(b))return b}},">":function(a){return function(b){return a(b=b.parentNode)&&b}},"+":function(a){return function(b){return a(b=i(b))&&b}},"~":function(a){return function(b){for(;b=
i(b);)if(a(b))return b}},noop:function(a){return function(b){return a(b)&&b}}},s=function(a){var b,c;if(typeof a!=="string"){if(a.length>1){for(var d=[],f=0,j=a.length;f<j;f++)d.push(s(a[f]));j=d.length;return function(a){for(f=0;f<j;f++)if(!d[f](a))return;return true}}return a[0]==="*"?e["*"]:e.type(a[0])}switch(a[0]){case ".":return e.attr("class","~=",a.substring(1));case "#":return e.attr("id","=",a.substring(1));case "[":return b=/^\[([\w-]+)(?:([^\w]?=)([^\]]+))?\]/.exec(a),e.attr(b[1],b[2]||
"-",q(b[3]));case ":":return(b=/^(:[\w-]+)\(([^)]+)\)/.exec(a))&&(a=b[1],c=q(b[2])),c?e[a](c):e[a];case "*":return e["*"];default:return e.type(a)}},k=function(a){for(var b=[],c=m.noop,d,f,e,a=a.replace(/(^|\s)(:|\[|\.|#)/g,"$1*$2");f=/\s*((?:\w+|\*)(?:[.#:][^\s]+|\[[^\]]+\])*)\s*$/.exec(a);)if(e=a.length-f[0].length,f=f[1].split(/(?=[\[:.#])/),d||(d=f[0]),b.push(c(s(f))),e)f=a[e-1],c=m[f]||m[f=" "],a=a.substring(0,f!==" "?--e:e);else break;b=t(b);b.qname=d;return b},t=function(a){return function(b){for(var c=
0,d;d=a[c++];)if(!(b=d(b)))return;return true}},n=function(a,b){if(~a.indexOf(",")){for(var a=a.split(/,\s*(?![^\[]*["'])/),c=[],d=0,e=a.length;d<e;d++)for(var j=n(a[d],b),g=0,l=j.length;g<l;g++){for(var i=j[g],h=c.length;h--&&c[h]!==i;);h===-1&&c.push(i)}return c}d=0;c=[];e=k(a);for(j=b.getElementsByTagName(e.qname);g=j[d++];)e(g)&&c.push(g);return c},n=function(){var a=n,b=function(){try{return Array.prototype.slice.call(l.getElementsByTagName("*")),Array.prototype.slice}catch(a){return a=null,
function(){for(var a=[],b=0,c=this.length;b<c;b++)a.push(this[b]);return a}}}();return l.querySelectorAll?function(c,d){try{return b.call(d.querySelectorAll(c))}catch(e){return a(c,d)}}:function(c,d){if(!~c.indexOf(" ")){if(c[0]==="#"&&/^#\w+$/.test(c))return[d.getElementById(c.substring(1))];if(c[0]==="."&&/^\.\w+$/.test(c))try{return b.call(d.getElementsByClassName(c.substring(1)))}catch(e){}if(/^\w+$/.test(c))return b.call(d.getElementsByTagName(c))}return a(c,d)}}();(function(){var a=l.createElement("div");
a.appendChild(l.createComment(""));return!!a.getElementsByTagName("*")[0]})()&&(e["*"]=function(a){if(a.nodeType===1)return true});var g=function(a,b){try{return n(a,b||l)}catch(c){return typeof console!=="undefined"&&console.log(c.stack||c+""),[]}};g.selectors=e;g.operators=r;g.combinators=m;g.compile=k;g.matches=function(a,b){return!!k(b)(a)};g.cache=function(){var a={},b=k;g.compile=k=function(c){return a[c]||(a[c]=b(c))}};o.zest=g}).call(this);
</script>
<div id="test">
<div class="testlink">
<a href="#" id="linkone" title="test">test link</a>
</div>
<div class="testmenu">
<ul>
<li class="menuitem itemone">
<a href="#" title="item 1">menu item 1</a>
</li>
<li class="menuitem itemtwo">
<a href="#" title="item 2">menu item 2</a>
</li>
<li class="menuitem itemthree">
not clickable item 3
</li>
</ul>
</div>
</div>
<script>
var selectors = ['body', 'div', 'body div', 'div a', 'div > a', 'div[class^=test]', 'div, li, a', '.menuitem', 'li.menuitem', '#linkone', 'div#test', 'a[title*=item]', 'a[title=test]', 'li:nth-child(even)', 'li:nth-child(odd)', 'li:last-child', 'li:first-child'];
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
jQuery 1.4 (with Sizzle) |
| ready |
jQuery 1.2 (no Sizzle) |
| ready |
Sizzle |
| ready |
Midori |
| ready |
YUI |
| ready |
Peppy |
| ready |
Dojo |
| ready |
XUI |
| ready |
jQuery 1.7 |
| ready |
qwery master/00cda9fedeb78e4259e99c2a875a36a835dddee3 |
| ready |
Zest |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.