.toFixed vs Math.round toString (v21)

Revision 21 of this benchmark created on


Setup

var test = [1.2345, 2.3456, 3.4567, 4.5678, 5.6789];

Test runner

Ready to run.

Testing in
TestOps/sec
Math.round toString
for (var i = 0, ii = test.length; i < ii; i++) {
  Math.round(test[i]).toString();
}
ready
.toFixed
for (var i = 0, ii = test.length; i < ii; i++) {
  test[i].toFixed();
}
ready

Revisions

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