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
use random, slightly more realistic data
<script>
data = [];
for(var i = 0; i < 1000; i++){
data[i] = {
x: Math.random(),
y: Math.random(),
z: Math.random(),
s: "str-"+Math.random()
};
}
Obj = function(opts) {
this.x = opts.x;
this.y = opts.y;
this.z = opts.z;
this.s = opts.s;
};
wrapper = function(opts) {
return new Obj(opts);
};
wrapper2 = function(opts) {
var o = {
x : opts.x,
y : opts.y,
z : opts.z,
s : opts.s
};
return o;
};
Obj.prototype.create = function(opts) {
return new Obj(opts);
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Object.create() using in-place property object |
| ready |
Object.create() using constant property object |
| ready |
Constructor function |
| ready |
Constructor wrapper |
| ready |
Prototype pattern with constructor wrapper |
| ready |
Constructor wrapper2 with literal |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.