Quote Originally Posted by jemidiah
A bit OT, but the original question seems to have been answered, and this is a programming forum after all:

I can understand why the if branches would be slower, but why did they implement integer addition in a way that makes it about as slow as multiplications? That seems really silly.
The bit about integer addition annoyed the heck out of me when I first discovered it. I had an approximation for the Pythagorean Theorem based on the RISC subset of the instruction set for x86 processors, and decided to test it in VB. It turned out that using the full method, complete with multiplications and square roots, was faster than the integer and bit shifting method. That kind of kills off some optimization options.

By the way, in this case, turning off the integer overflow checks improved the performance of both routines by about 30%, as well, but the benefit was roughly equal for both techniques (actually, I think it helped the branching technique by about 40%, and the mathematical approach by just under 30%).