Even or odd

Benchmark created by kuzyn on


Setup

let even = 123456
  let odd = 123457

Test runner

Ready to run.

Testing in
TestOps/sec
Bit check equal
!!((even & 1) == 0)
!!((odd & 1) == 0)
ready
Bit check not equal
!!((even & 1) != 1)
!!((odd & 1) != 1)
ready
Modulo check equal
!!((even % 2) == 0)
!!((odd % 2) == 0)
ready
Modulo check not equal
!!((even % 2) != 1)
!!((odd % 2) != 1)
ready
Binary check cast
!!(even & 1)
!!(odd & 1)
ready
Modulo check cast
!!(even % 2)
!!(odd % 2)
ready

Revisions

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