Code efficiency

Kevin Buettner kev@primenet.com
Mon, 7 Feb 2000 15:11:05 -0700


On Feb 7,  2:30pm, Gorman, John wrote:

> A good way to see which one is more effecient is to compile
> the code and generate the assembler code. 

It may be instructive.  (It used to be the case that you could
count clock cycles to see which piece of code is more efficient,
but that has gotten to be very difficult.  The only sure-fire
way to tell whether one piece of code is going to be faster
than another is to benchmark them.)

> See which one produces the most lines of code (LOC). The one with
> the least LOC is the one that is more efficient and will most
> probably run faster.

Counting the number of lines of code tells you nothing.  Many times
the compiler will do optimizations that are intended to improve
performance (speed) at the expense of space.

Kevin

-- 
Kevin Buettner
kev@primenet.com, kevinb@redhat.com