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
https://gist.github.com/1239433
<script>
var sqrt = (function () {
"use strict";
function sqrt (n, x, p) {
return Math.abs(x*x - n) < p ? x : sqrt(n, (n/x + x) / 2, p);
}
return function (n) {
return sqrt(n, 1, 0.1);
};
})();
// Alternative to Math.abs
function abs(x) {
return (x < 0 ? -x : x);
}
var fast_sqrt = (function () {
"use strict";
function sqrt (n, x, p) {
return abs(x*x - n) < p ? x : sqrt(n, (n/x + x) / 2, p);
}
return function (n) {
return sqrt(n, 1, 0.1);
};
})();
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Sqrt |
| ready |
Math.sqrt |
| ready |
Alternative sqrt |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.