Oldest trick in the book, check if an integer is even or not. How do you do it? A nice and simple
num % 2 == 0 ?
That's how most of us did it for a long time. Don't even think about it, almost a reflex thing, am I right?
First of all, why is modulo slow?
Well, the modulo operation does more than just checking if a number is even or not, it returns the reminder of the division of both elements (and computers really hate dividing).
This works for us because an even number will always have a reminder of 0 when divided by 2, but we are wasting precious sweet sweet CPU cycles.
But what other nice and useful property have even numbers? Their last bit is always 1.
And how can we check the value of a single bit? With a beautiful and simple single-instruction binary AND
But hey, at least you now know a little bit (hehe see what I did there) better how things work under the hood!