The following optimization can be made to mod operations. This can be applied where applicable with a comment explaining the original operation for clarity
n % x === n & (x-1) when x is a power of 2 but bitwise AND is much faster
Originally posted by @kevinrr888 in #6025 (comment)