unary

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
unary
let flag = true;
const N = 1e7;
let sum1 = 0;
for (let i = 0; i < N; i++) sum1 += +flag;
ready
Number
let flag = true;
const N = 1e7;
let sum2 = 0;
for (let i = 0; i < N; i++) sum2 += Number(flag);
ready
ParseInt
let flag = true;
const N = 1e7;
let sum3 = 0;
for (let i = 0; i < N; i++) sum3 += parseInt(flag, 10);
ready

Revisions

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