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
function Person(name) {
this.name = name;
}
Person.prototype.get_name = function() {
return this.name;
};
Person.prototype.set_name = function(name) {
this.name = name;
};
Person.prototype.do_nothing = function() {
};
// let's say there are 10 more methods
Person.prototype.f0 = function() { return 'f0a'; };
Person.prototype.f1 = function() { return 'f1a'; };
Person.prototype.f2 = function() { return 'f2a'; };
Person.prototype.f3 = function() { return 'f3a'; };
Person.prototype.f4 = function() { return 'f4a'; };
Person.prototype.f5 = function() { return 'f5a'; };
Person.prototype.f6 = function() { return 'f6a'; };
Person.prototype.f7 = function() { return 'f7a'; };
Person.prototype.f8 = function() { return 'f8a'; };
Person.prototype.f9 = function() { return 'f9a'; };
var person = function(name) {
var p = {
name: name
};
return {
'get_name': function() {
return p.name;
},
'set_name': function(name) {
p.name = name;
},
'do_nothing': function() {
},
'f0': function() { return 'f0b' },
'f1': function() { return 'f1b' },
'f2': function() { return 'f2b' },
'f3': function() { return 'f3b' },
'f4': function() { return 'f4b' },
'f5': function() { return 'f5b' },
'f6': function() { return 'f6b' },
'f7': function() { return 'f7b' },
'f8': function() { return 'f8b' },
'f9': function() { return 'f9b' }
};
};
var _p = new Person('John');
var _c = person('John');
Ready to run.
Test | Ops/sec | |
---|---|---|
Prototype init |
| ready |
Closure init |
| ready |
Prototype read |
| ready |
Closure read |
| ready |
Prototype write |
| ready |
Closure write |
| ready |
Prototype invoke function |
| ready |
Closure invoke function |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.