Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Math.sqrt() vs Fast inverse sqrt
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:147.0) Gecko/20100101 Firefox/147.0
Browser:
Firefox 147
Operating system:
Linux
Device Platform:
Desktop
Date tested:
5 months ago
Test name
Executions per second
1 / Math.sqrt()
1361737.9 Ops/sec
Fast inverse sqrt
34188.4 Ops/sec
Script Preparation code:
let v = 123.75; function test1() { let r; for(let i = 0; i < 2000; ++i) r = 1 / Math.sqrt(v); } function test2() { let r; for(let i = 0; i < 2000; ++i) r = Q_sqrt(v); } function Q_sqrt(num) { let i = []; let y = []; y[0] = num; i[0] = 0x5f375a86 - (i[0] >> 1); y[0] = y[0] * (1.5 * ((num * 0.5) * y[0] * y[0])); return y[0]; }
Tests:
1 / Math.sqrt()
test1();
Fast inverse sqrt
test2();