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
<script>
// http://twitter.com/cowboy/status/15344233981
function pad(n, d) {
return Array(Math.max(0, d - (n + '').length + 1)).join(0) + n;
};
// http://www.electrictoolbox.com/pad-number-zeroes-javascript/
function pad2(number, length) {
var str = '' + number;
while (str.length < length) {
str = '0' + str;
};
return str;
};
function pad3(n, d) {
return ((Math.pow(10, d) + n) + '').substr(1);
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Ben Alman’s pad() function |
| ready |
The pad2() function |
| ready |
The pad3() function |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.