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
Testing the difference in execution time of creating objects using the prototype and not using it.
<script>
function Person(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
Person.prototype.getFullName = function() {
return this.firstName + " " + this.lastName;
};
function Person2(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
this.getFullName = function() {
return this.firstName + " " + this.lastName;
};
}
function getFullName() { return this.firstName + " " + this.lastName; };
function Person3(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
this.getFullName = getFullName;
}
</script>Ready to run.
| Test | Ops/sec | |
|---|---|---|
| Prototype | | ready |
| Non-Prototype (Nested) | | ready |
| Non-Prototype (Cached) | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.