Why is (a*b != 0) faster than (a != 0 && b != 0) in Java?
I’m ignoring the issue that your benchmarking might be flawed, and taking the result at face value. Is it the compiler or is it at the hardware level? That latter, I think: if (a != 0 && b != 0) will compile to 2 memory loads and two conditional branches if (a * b != … Read more