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 MyType = function MyType() { }
var obj_dispatch = {}
obj_dispatch[String] = function(str) { return str; }
String.prototype.runFn = function() { return this; }
obj_dispatch[MyType] = function(obj) { return obj; }
MyType.prototype.runFn = function() { return this; }
function runFn(obj) {
if (typeof(obj) === "string") {
return obj_dispatch[String](obj);
} else {
return obj_dispatch[obj.constructor](obj);
}
}
var prim = "Hello";
var str = new String("Hello");
var my_obj = new MyType();
Ready to run.
Test | Ops/sec | |
---|---|---|
primitive dispatch |
| ready |
wrapped dispatch |
| ready |
native method |
| ready |
object dispatch |
| ready |
native method |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.