Compare power methods

Benchmark created on


Description

Compare Math.pow(10, 10), 1e10, 10**10

Setup

round1 = value => {
  const factor = Math.pow(10, 10);
  Math.round(value * factor) / factor;
}

round2 = value => {
  const factor = 10**10;
  Math.round(value * factor) / factor;
}

round3 = value => {
  const factor = 1e10;
  Math.round(value * factor) / factor;
}

Test runner

Ready to run.

Testing in
TestOps/sec
Math.pow(10, 10)
round1(0.1+0.2)
ready
10**10
round2(0.1+0.2)
ready
1e10
round1(0.1+0.2)
ready

Revisions

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