Re: CONUNDRUM

Colin Plumb (colin@nyx.net)
Thu, 13 Feb 97 12:56:39 MST


Aigning the stack can make a difference, but I have a more likely
candidate: operand size prefixes. If the code does a lot of
16-bit math and not much 32-bit math, and runs in 16-bit mode
under DOS and Windows, but in 32-bit mode on Linux, all of those
operand size prefixes (one cycle each, non-pairable) can eat a lot of
time.

I know some PC programmers who habitually use "short" everywhere
instead of "int" when they really don't care, and it costs.

One time I was working on an inner loop, which I had hand-coded
in assembly to get maximum speed out of it. Then I looked at the
overhead of the next loop out. (Basically, I compared the timing
of 10 inner loops of 1000 iterations each with 1000 inner loops
of 10 iterations each. The difference is 990x the overhead per
outer loop iteration.)

Changing one variable from "short" to "int" made a noticeable
difference.

-- 
	-Colin