Math.round() VS. toFixed() (v4)

Revision 4 of this benchmark created on


Setup

function test1() {
      return Math.round(123.3213211 * 10000000) / 1000000;
    };
    
    function test2() {
      return +(123.3213211).toFixed(7);
    };

Test runner

Ready to run.

Testing in
TestOps/sec
Math.round()
test1();
ready
toFixed()
test2();
ready

Revisions

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