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
var args = [1, 2, 3, 4, 5, 6];
var withoutRedefine = function(){
// Declare vars once
var
a = 1
, b = 2
, c = 3000
, d = 4000000
, e
, f
, g
// Assuming we actually have some work creating our vars
, myArgs = args.slice(3, 5).join(" ").split(" ")
;
// Access variables
if (a < b && b < c && c < d){
e = f = g = 1;//myArgs[2];
}
};
var withRedefine = function(){
// Declare vars once
var
a = 1
, b = 2
, c = 3000
, d = 4000000
, e
, f
, g
, myArgs = args.slice(3, 5).join(" ").split(" ")
;
// Redefine test
withRedefine = function(){
// Access variables
if (a < b && b < c && c < d){
e = f = g = 1;//myArgs[2];
}
};
// Call the new test
withRedefine();
};
Ready to run.
Test | Ops/sec | |
---|---|---|
Without Redefine |
| ready |
With Redefine |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.