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
<script>
var native = function() {
this.label = "";
this.stringAppend = function() {
this.label = "hello" + "world";
}
}
var proto = function() {
this.label = "";
}
proto.prototype.stringAppend = function() {
this.label = "hello" + "world";
}
var bind = function() {
this.label = "";
this.stringAppend = function() {
this.label = "hello" + "world";
}.bind(this);
}
var closure = function() {
this.label = "";
var self = this;
self.stringAppend = function() {
self.label = "hello" + "world";
}
}
// test function and context
var testcxt = {},
testarg1 = 'test',
testarg2 = {},
testarg3 = 1,
testarg4 = {},
testfunc = function() {
if (this !== testcxt || arguments.length != 4) throw new Error('failed');
};
var first = native.stringAppend();
var second = proto.stringAppend();
var third = closure.stringAppend();
var native = bind.stringAppend();
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
First |
| ready |
Second |
| ready |
Third |
| ready |
Native |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.