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 createChristmasTree(ornaments, height) {
let ornamentIdx = 0;
let tree = '';
const spaces = ' '.repeat(height);
for (let level = 1; level <= height; level++) {
tree += spaces.slice(0, height - level);
for (let charPosition = 0; charPosition < level * 2 - 1; charPosition++)
if (charPosition % 2 === 0) {
tree += ornaments[ornamentIdx];
ornamentIdx = (ornamentIdx + 1) % ornaments.length;
} else {
tree += ' ';
}
tree += '\n';
}
return tree + spaces.slice(0, height - 1) + '|\n';
}
Ready to run.
Test | Ops/sec | |
---|---|---|
case1 |
| ready |
case2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.