js square: `x * x` vs `x ** 2`

Benchmark created on


Setup

min = 1000;
max = 10000;

Test runner

Ready to run.

Testing in
TestOps/sec
x * x
let sum = 0;
for (let i = min; i < max; i++) {
	sum += i * i;
}
ready
x ** 2
let sum = 0;
for (let i = min; i < max; i++) {
	sum += i ** 2;
}
ready

Revisions

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