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
let obj = {
a: 32,
b: 52
};
let obj2 = {
a:32,
b: 52
};
function foo(a, b) {
return a+b
}
let arr = [obj, obj2];
function jsobj2pyobj(jsobj, _this = null) {
switch(jsobj) {
case true:
case false:
return jsobj
}
if(jsobj === undefined){
return null
}else if(jsobj === null){
return null
}
if(Array.isArray(jsobj)){
return jsobj.map(jsobj2pyobj)
}else if(typeof jsobj === 'number'){
return null
}else if(typeof jsobj == "string"){
return null
}else if(typeof jsobj == "function"){
_this = _this === undefined ? null : _this
return function(){
var args = []
for(var i = 0, len = arguments.length; i < len; i++){
args.push(pyobj2jsobj(arguments[i]))
}
return jsobj2pyobj(jsobj.apply(_this, args))
}
}
if(jsobj.kw) {
return jsobj
}
return jsobj
}
let wrapper = jsobj2pyobj(obj);
let array_wrapper = jsobj2pyobj(arr);
let wm = new WeakMap();
wm.set(obj, wrapper);
wm.set(arr, array_wrapper);
function cache(obj) {
obj = wm.get(obj);
if(obj !== null)
return obj
return jsobj2pyobj(obj)
}
Ready to run.
Test | Ops/sec | |
---|---|---|
no cache |
| ready |
in cache |
| ready |
no in cache |
| ready |
array |
| ready |
cache array |
| ready |
fct |
| ready |
cache fct |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.