Length (Math.hypot)

Benchmark created on


Setup

const xlen = 1/3
const ylen = 2/3
let result = 0

Test runner

Ready to run.

Testing in
TestOps/sec
Math.hypot
result = Math.hypot(xlen, ylen)
ready
JS impl (power op)
result = (xlen**2 + ylen**2) ** 0.5
ready
JS impl (mul op)
result = (xlen*xlen + ylen*ylen) ** 0.5
ready
Math.sqrt (power op)
result = Math.sqrt(xlen**2 + ylen**2)
ready
Math.sqrt (mul op)
result = Math.sqrt(xlen*xlen + ylen*ylen)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.