For loop condition (i >= 0 vs i - 1 vs !!~i)

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
i >= 0
let temp = 0
for (let i = 100; i >= 0; --i) {
    temp += i
}
ready
i - 1
let temp = 0
for (let i = 100; i - 1; --i) {
    temp += i
}
ready
!!~i
let temp = 0
for (let i = 100; !!~i; --i) {
    temp += i
}
ready

Revisions

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