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
The purpose of this benchmark is to determine the performance differences between data properties, accessor properties and getters / setter functions.
var data = {
property: property
};
var property = undefined;
var method = {
getProperty: function() {
return property;
},
setProperty: function(value) {
property = value;
}
};
var objectLiteralAccessor = {
get property() {
return property;
},
set property(value) {
property = value;
}
};
function Class() {
}
Class.prototype = {
get property() {
return property;
},
set property(value) {
property = value;
}
};
var prototypeAccessor = new Class();
Ready to run.
Test | Ops/sec | |
---|---|---|
Read from data property |
| ready |
Write to data property |
| ready |
Read from getter method |
| ready |
Write to setter method |
| ready |
Read from object literal accessor property |
| ready |
Write to object literal accessor property |
| ready |
Read from object literal accessor property on prototype. |
| ready |
Write to object literal accessor property on prototype. |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.