Division vs. multiplication (v3)

Revision 3 of this benchmark created on


Description

Tiny performance test to see how much a division costs when projecting 3d points to screen.

Setup

var focalLength = 3.015;
    
    function slow(x, y, z) {
      return {
        x: x / z,
        y: y / z
      };
    }
    
    function fast(x, y, z) {
      return {
        x: x * z,
        y: y * z
      };
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Slow
slow(3, 5, 7);
slow(3.23, 5.32, 7.01);
ready
Fast
fast(3, 5, 0.14285714285714285);
fast(3.23, 5.32, 0.14265335235378032);
ready

Revisions

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