Rounding numbers down (v19)

Revision 19 of this benchmark created by BigBossSNK on


Setup

i = 0

Teardown



            i = 0
        
  

Test runner

Ready to run.

Testing in
TestOps/sec
Math.floor
for (i = 0; i < 10000; i+=1.5){
Math.floor(i) // 3
}
ready
parseInt
for (i = 0; i < 10000; i+=1.5){
parseInt(i, 10) // 3
}
ready
Double bitwise NOT
for (i = 0; i < 10000; i+=1.5){
~~i // 3
}
ready
Bitwise OR
for (i = 0; i < 10000; i+=1.5){
i | i // 3
}
ready
Bitwise OR with 0
for (i = 0; i < 10000; i+=1.5){
i | 0 // 3
}
ready
Bitwise AND
for (i = 0; i < 10000; i+=1.5){
i & i // 3
}
ready
Bitwise left shift
for (i = 0; i < 10000; i+=1.5){
i << 0 // 3
}
ready
toFixed
for (i = 0; i < 10000; i+=1.5){
i.toFixed() // 3
}
ready

Revisions

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