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 jsSqrt(number, epsilon = 0.00001) {
if (number < 0) {
return NaN; // Square root of negative number is undefined
}
let guess = number / 2; // Initial guess can be any positive number
let prevGuess;
do {
prevGuess = guess;
guess = 0.5 * (guess + number / guess);
} while (Math.abs(guess - prevGuess) > epsilon);
return guess;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
jsSqrt |
| ready |
mathSqrt |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.