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 q vs. getElementById vs. getElementsByClassName vs. jQuery (v150) Revision 150 of this benchmark created by ZAlexz on March 21, 2015 Preparation HTML <script src ="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js" >
</script >
<p id ="bar" class ="my-bar" >
Bar
</p >
<div id ="coo" class ="my-foo" >
<div id ="car" class ="my-bar" >
<div id ="caz" class ="my-bar" >
<div id ="hoo" class ="my-boo" >
<div id ="har" class ="my-bar" >
<div id ="haz" class ="my-bar" >
<div id ="yoo" class ="my-boo" >
<div id ="yar" class ="my-bar" >
<div id ="yaz" class ="my-bar" >
<div id ="zoo" class ="my-boo" >
<div id ="zar" class ="my-bar" >
<div id ="zaz" class ="my-bar" >
<span id ="baz" class ="my-baz" > Baz</span >
</div >
</div >
</div >
</div >
</div >
</div >
</div >
</div >
</div >
</div >
</div >
</div >
Setup var zaz = document .getElementById ('zaz' );
function El (el ){ this ._el = el; }
El .prototype .append = function append (el ){ this ._el .appendChild (el); return this ; }
function q (id ){ return new El (document .getElementById (id)); }
function qq (_class ){ return document .getElementsByClassName (_class); }
function qqTag (tag ){ return document .getElementsByTagName (tag); }
function qs (selector ){ return new
El (document .querySelector (selector)); }
function $q (selector ){
if (typeof selector === 'object' ){
return new El (selector);
} else {
if (selector.indexOf ('#' ) === 0 ) return q (selector.substr (1 ));
if (selector.indexOf ('.' ) === 0 ) return qq (selector.substr (1 ));
if (selector.match ( /[\#\.\[\ \:]/ ) ) return qs (selector);
else return qqTag (selector);
}
}
function DOMcomb (parent, elems, filter_callback ) {
var cs = parent.children , len = cs.length ;
if (filter_callback (parent)) elems.push (parent);
if (len) for (var i = 0 ; i < len; ++i) DOMcomb (cs[i], elems, filter_callback);
}
Test runner Ready to run.
Run Quick Run Testing in Test Ops/sec getElementById var baz = document .getElementById ("baz" );
ready
q(id) var baz = q ('baz' );
ready
el.getElementsByClassName var baz = zaz.getElementsByClassName ('my-baz' );
ready
qq(class) var baz = qq ('my-baz' );
ready
DOMcomb(el) var elems = [ ];
DOMcomb (zaz, elems,
function (el ){ return (el.className .indexOf ('my-baz' ) >= 0 );
});
ready
$q(#id) var baz = $q("#baz" );
ready
$(el) var zaz = $(zaz);
ready
$q(el) var zaz = $q(zaz);
ready
Revisions You can edit these tests or add more tests to this page by appending /edit to the URL.
Revision 1 : published by Ara Pehlivanian on September 30, 2010 Revision 3 : published on August 18, 2011 Revision 4 : published on September 9, 2011 Revision 5 : published on October 27, 2011 Revision 6 : published on December 31, 2011 Revision 7 : published on January 4, 2012 Revision 8 : published by vamp on January 4, 2012 Revision 9 : published on January 19, 2012 Revision 10 : published on March 4, 2012 Revision 11 : published on March 13, 2012 Revision 12 : published on March 20, 2012 Revision 14 : published on May 29, 2012 Revision 15 : published by Name64 on May 29, 2012 Revision 16 : published on August 22, 2012 Revision 17 : published on August 22, 2012 Revision 18 : published on August 29, 2012 Revision 19 : published on August 29, 2012 Revision 20 : published on September 18, 2012 Revision 21 : published on September 19, 2012 Revision 22 : published on October 23, 2012 Revision 23 : published on October 30, 2012 Revision 24 : published on November 13, 2012 Revision 25 : published on November 15, 2012 Revision 26 : published on November 19, 2012 Revision 27 : published on November 28, 2012 Revision 28 : published by dc on November 29, 2012 Revision 30 : published on January 3, 2013 Revision 31 : published on January 21, 2013 Revision 32 : published on March 25, 2013 Revision 33 : published by AjiTae on April 2, 2013 Revision 34 : published by AjiTae on April 2, 2013 Revision 37 : published on June 16, 2013 Revision 38 : published on June 16, 2013 Revision 39 : published by jayli on June 25, 2013 Revision 40 : published on June 27, 2013 Revision 42 : published on August 12, 2013 Revision 43 : published on August 22, 2013 Revision 44 : published by Bigger dom on September 5, 2013 Revision 45 : published by Bigger dom on September 5, 2013 Revision 46 : published by Bigger dom on September 5, 2013 Revision 47 : published on September 12, 2013 Revision 48 : published on September 17, 2013 Revision 49 : published on September 18, 2013 Revision 50 : published on September 29, 2013 Revision 51 : published on September 29, 2013 Revision 52 : published on October 11, 2013 Revision 53 : published by shel on October 17, 2013 Revision 54 : published on October 20, 2013 Revision 55 : published on October 20, 2013 Revision 57 : published on October 31, 2013 Revision 58 : published on October 31, 2013 Revision 59 : published on November 1, 2013 Revision 60 : published on November 18, 2013 Revision 61 : published on November 24, 2013 Revision 62 : published on November 26, 2013 Revision 63 : published on December 4, 2013 Revision 64 : published on December 4, 2013 Revision 65 : published by Cory on December 12, 2013 Revision 66 : published on December 13, 2013 Revision 67 : published on December 13, 2013 Revision 68 : published on January 8, 2014 Revision 69 : published by One If vs Nested If on January 17, 2014 Revision 70 : published on January 18, 2014 Revision 71 : published on February 6, 2014 Revision 72 : published on February 11, 2014 Revision 73 : published on February 12, 2014 Revision 77 : published by ermaneng on March 11, 2014 Revision 78 : published by Joshua Koudys on March 20, 2014 Revision 79 : published by Joshua Koudys on March 21, 2014 Revision 81 : published on April 3, 2014 Revision 82 : published by Henry Zou on May 7, 2014 Revision 83 : published by Henry Zou on May 13, 2014 Revision 84 : published on May 18, 2014 Revision 85 : published on May 19, 2014 Revision 86 : published on May 19, 2014 Revision 87 : published on May 21, 2014 Revision 88 : published on June 6, 2014 Revision 89 : published on June 6, 2014 Revision 90 : published on June 22, 2014 Revision 91 : published on June 23, 2014 Revision 93 : published on July 3, 2014 Revision 94 : published by Mario Valle on July 17, 2014 Revision 95 : published on July 22, 2014 Revision 96 : published on July 22, 2014 Revision 97 : published on July 22, 2014 Revision 98 : published on August 6, 2014 Revision 99 : published on August 15, 2014 Revision 100 : published by Owyn on August 20, 2014 Revision 101 : published on September 17, 2014 Revision 102 : published on September 18, 2014 Revision 103 : published on September 22, 2014 Revision 105 : published on September 30, 2014 Revision 108 : published by Neil Kistner on October 3, 2014 Revision 109 : published by te on October 6, 2014 Revision 110 : published on October 7, 2014 Revision 111 : published on November 16, 2014 Revision 112 : published on November 16, 2014 Revision 113 : published on November 19, 2014 Revision 115 : published on November 28, 2014 Revision 116 : published on November 28, 2014 Revision 117 : published by DarkPark on December 4, 2014 Revision 118 : published by Shahar on December 4, 2014 Revision 120 : published by Rob on December 11, 2014 Revision 123 : published on December 17, 2014 Revision 124 : published on December 29, 2014 Revision 125 : published on December 31, 2014 Revision 126 : published on December 31, 2014 Revision 127 : published on January 4, 2015 Revision 128 : published on January 15, 2015 Revision 129 : published on January 15, 2015 Revision 130 : published by Chris on January 20, 2015 Revision 131 : published by sopi on January 20, 2015 Revision 132 : published by dubai on January 26, 2015 Revision 133 : published by test077 on January 30, 2015 Revision 134 : published by David Anderton on January 30, 2015 Revision 135 : published on February 1, 2015 Revision 136 : published on February 1, 2015 Revision 137 : published by ro on February 9, 2015 Revision 138 : published by tester on February 11, 2015 Revision 139 : published on February 19, 2015 Revision 140 : published on February 26, 2015 Revision 141 : published on March 2, 2015 Revision 143 : published by Kiura Magomadov on March 9, 2015 Revision 144 : published by Nicholas Cloud on March 17, 2015 Revision 145 : published by ZAlexz on March 20, 2015 Revision 146 : published by ZAlexz on March 20, 2015 Revision 147 : published by ZAlexz on March 20, 2015 Revision 148 : published by ZAlexz on March 20, 2015 Revision 150 : published by ZAlexz on March 21, 2015 Revision 151 : published on March 23, 2015 Revision 152 : published on March 30, 2015 Revision 153 : published on April 14, 2015 Revision 154 : published on April 14, 2015 Revision 155 : published on April 21, 2015 Revision 156 : published on April 21, 2015 Revision 157 : published on April 21, 2015 Revision 159 : published by test on April 22, 2015 Revision 160 : published on April 27, 2015 Revision 161 : published on April 28, 2015 Revision 162 : published by n on April 29, 2015 Revision 163 : published by Nk_bet on May 8, 2015 Revision 164 : published on May 8, 2015 Revision 165 : published on May 12, 2015 Revision 166 : published on May 16, 2015 Revision 167 : published on May 19, 2015 Revision 168 : published by Costas on May 20, 2015 Revision 169 : published on May 20, 2015 Revision 172 : published on May 22, 2015 Revision 175 : published on June 16, 2015 Revision 176 : published on June 18, 2015 Revision 178 : published on July 15, 2015 Revision 179 : published on July 15, 2015 Revision 180 : published on August 5, 2015 Revision 181 : published by Hravad on August 13, 2015 Revision 182 : published on August 14, 2015 Revision 184 : published on August 19, 2015 Revision 185 : published on August 19, 2015 Revision 186 : published on August 22, 2015 Revision 187 : published on September 3, 2015 Revision 188 : published on September 11, 2015 Revision 189 : published by Saroyanm on September 23, 2015 Revision 190 : published on September 23, 2015 Revision 191 : published on September 23, 2015 Revision 192 : published on September 23, 2015 Revision 193 : published on September 23, 2015 Revision 194 : published on September 23, 2015 Revision 195 : published by dan on October 2, 2015 Revision 196 : published by dan on October 2, 2015 Revision 198 : published on October 4, 2015 Revision 200 : published by lokait on October 7, 2015 Revision 207 : published on October 20, 2015 Revision 208 : published on October 31, 2015 Revision 209 : published on November 3, 2015 Revision 211 : published on November 11, 2015 Revision 212 : published on November 13, 2015 Revision 213 : published on November 13, 2015 Revision 215 : published by fun on November 16, 2015 Revision 217 : published on November 23, 2015 Revision 218 : published on November 30, 2015 Revision 223 : published by Sayed Baladoh on December 23, 2015 Revision 224 : published on January 6, 2016 Revision 226 : published on January 13, 2016 Revision 228 : published on January 19, 2016 Revision 230 : published on January 20, 2016 Revision 232 : published by sgraham785 on January 22, 2016 Revision 243 : published on February 19, 2016 Revision 248 : published on March 3, 2016 Revision 249 : published on March 3, 2016 Revision 252 : published on March 16, 2016 Revision 253 : published on March 16, 2016 Revision 254 : published by till t on March 16, 2016 Revision 289 : published on March 8, 2019 Revision 290 : published on March 8, 2019 Revision 291 : published on March 8, 2019