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 bind vs emulate (v15) Revision 15 of this benchmark created on January 3, 2014 Preparation HTML <div > </div >
<script >
var emulatebind = function (f, context ) {
var curriedArgs = Array .prototype .slice .call (arguments , 2 );
return function ( ) {
var allArgs = curriedArgs.slice (0 );
for (var i = 0 , n = arguments .length ; i < n; ++i) {
allArgs.push (arguments [i]);
}
return f.apply (context, allArgs);
};
};
var i = { i : 0 };
var f = function (n ) {
this .i += n;
return Math .sqrt (this .i );
};
function bind (fn, ctx ) {
return function ( ) {
return fn.apply (ctx, arguments );
};
}
</script >
Setup var binded = f.bind (i);
var emulated = emulatebind (f, i);
var simple = bind (f, i);
var self = function (n ) {
i.i += n;
return Math .sqrt (i.i );
}
Test runner Ready to run.
Run Quick Run Testing in Test Ops/sec bind binded (Math .random ());
ready
emulate emulated (Math .random ());
ready
simple simple (Math .random ());
ready
self self (Math .random ());
ready
Revisions You can edit these tests or add more tests to this page by appending /edit to the URL.
Revision 1 : published on December 28, 2011 Revision 2 : published on January 1, 2012 Revision 3 : published on January 6, 2012 Revision 4 : published on January 6, 2012 Revision 5 : published on January 6, 2012 Revision 6 : published by Domenic Denicola on January 6, 2012 Revision 7 : published on January 7, 2012 Revision 9 : published by gero3 on November 26, 2012 Revision 10 : published by termi on April 8, 2013 Revision 11 : published on June 13, 2013 Revision 12 : published on June 13, 2013 Revision 13 : published on September 20, 2013 Revision 14 : published by Jon-Carlos Rivera on January 3, 2014 Revision 15 : published on January 3, 2014 Revision 16 : published by d on January 13, 2014 Revision 17 : published on January 21, 2014 Revision 18 : published on January 21, 2014 Revision 19 : published on January 21, 2014 Revision 21 : published on April 3, 2014 Revision 23 : published by mtone on April 7, 2014 Revision 24 : published on May 23, 2014 Revision 25 : published by Avi Kohn on June 20, 2014 Revision 26 : published on July 23, 2014 Revision 27 : published by dh on August 27, 2014 Revision 28 : published by Sam on November 16, 2014 Revision 29 : published on December 2, 2014 Revision 30 : published by derrickw on December 13, 2014 Revision 31 : published on January 23, 2015 Revision 32 : published by Chirayu Krishnappa on March 9, 2015 Revision 33 : published by m93a on March 10, 2015