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
const _b_ = {
None: {}
}
let _trace_fct = _b_.None
$B = {
enter_frame: function(frame){
return _trace_fct },
trace_return: function(result) { console.log('return', result) },
trace_exception: function() { console.log('enabled'); }
};
$C = {
enter_frame: function(frame){
if( _trace_fct === _b_.None )
return {
trace_return: function(_arg){},
trace_exception: function(){}
};
}
};
const obj = {
trace_return: function(_arg){},
trace_exception: function(){}
};
$D = {
enter_frame: function(frame){
return obj;
}
};
function foo_A(a,b) {
let frame = []
frame.$f_trace = $B.enter_frame(frame)
try {
let result = a+b
if(frame.$f_trace !== _b_.None){
$B.trace_return(result)
}
return result;
} catch(e) {
if(frame.$f_trace !== _b_.None){
frame.$f_trace = $B.trace_exception()
}
}
}
function foo_B(a,b) {
let frame = []
const trace = frame.$f_trace = $C.enter_frame(frame)
try {
let result = a+b
trace.trace_return(result)
return result;
} catch(e) {
trace.trace_exception()
}
}
function foo_D(a,b) {
let frame = []
const trace = frame.$f_trace = $D.enter_frame(frame)
try {
let result = a+b
trace.trace_return(result)
return result;
} catch(e) {
trace.trace_exception()
}
}
function foo_C(a,b) {
let frame = []
$B.enter_frame(frame)
try {
let result = a+b
return result;
} catch(e) {}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Brython |
| ready |
Functions instead of conditions |
| ready |
Mode performance |
| ready |
Functions instead of conditions - precomputed |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.