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;
};
}
</script>
<span id="t1"></span> - <span id="t2"></span>
var name;
var name2;
var t1 = document.getElementById('t1');
var t2 = document.getElementById('t2');
t1.innerHTML = name;
t2.innerHTML = name2;
Ready to run.
Test | Ops/sec | |
---|---|---|
Prototype |
| ready |
Non-Prototype (Nested) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.