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
creating N (50) items, apply trivial calculations and display results (in order make sure no code gets dead-code-eliminated).
var numbers = Array.from({length: 500}, (v, i) => i)
class NumberMapper {
constructor(iterable) {
this.iterable = iterable;
this.mappingFunctions = [];
}
map(mapperFn) {
this.mappingFunctions.push(mapperFn);
return this;
}
*[Symbol.iterator]() {
for (const item of this.iterable) {
let result = item;
for (const mapperFn of this.mappingFunctions) {
result = mapperFn(result);
}
yield result;
}
}
forEach(callback) {
for (const item of this) {
callback(item);
}
}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
array methods |
| ready |
iterators |
| ready |
Iterable |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.