Exponentiation method comparison (v3)

Revision 3 of this benchmark created on


Description

Compares Math.pow, the exponentiation operator, and chained use of the multiplication operator to raise a value to the power of seven.

Setup

const foo = Math.floor(Math.random() * 10);

Test runner

Ready to run.

Testing in
TestOps/sec
`Math.pow`
Math.pow(foo, 7);
ready
Exponentiation operator
foo ** 7;
ready
Chained multiplication operator
foo * foo * foo * foo * foo * foo * foo;
ready

Revisions

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