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 underscore each vs for vs for in loops (v13) Revision 13 of this benchmark created by Dan on January 8, 2015 Preparation HTML <script src ="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" > </script >
<script src ="https://documentcloud.github.com/underscore/underscore.js" > </script >
<div id ="output" > </div >
Setup var $ = window .jQuery ,
_ = window ._ ,
obj = {"test" : 123 , "best" : 123 , "rest" : 123 },
i,j,
len = Object .keys (obj).length ,
outputDiv = document .getElementById ("output" ),
keys = Object .keys (obj);
Test runner Ready to run.
Run Quick Run Testing in Test Ops/sec Current Implementation _.each (obj, function (o ){
var a = o.test ,
b = o.best ,
c = o.rest ;
});
ready
for loop for (i= 0 ; i < len;i++){
var a = obj[keys[i]].test ,
b = obj[keys[i]].best ,
c = obj[keys[i]].rest ;
};
ready
for in loop for (j in obj){
var a = obj[j].test ,
b = obj[j].best ,
c = obj[j].rest ;
};
ready
Revisions You can edit these tests or add more tests to this page by appending /edit to the URL.
Revision 1 : published by Jeremy Ashkenas on October 17, 2011 Revision 4 : published by Paul Miller on October 20, 2011 Revision 5 : published by John-David Dalton on October 20, 2011 Revision 7 : published by Shane O'Sullivan on February 7, 2012 Revision 9 : published on August 24, 2012 Revision 10 : published on November 26, 2013 Revision 11 : published by Jesús Germade on December 17, 2014 Revision 12 : published by test on January 7, 2015 Revision 13 : published by Dan on January 8, 2015 Revision 14 : published by Jesús Germade on February 27, 2015 Revision 15 : published by Jesús Germade on February 28, 2015 Revision 16 : published by Jesús Germade on February 28, 2015 Revision 17 : published by mingc on October 14, 2015 Revision 18 : published by Eldar Abusalimov on February 16, 2016