a style question

AthanasiosTom Zougas zougas at me.utoronto.ca
Tue Oct 2 00:26:04 AEST 1990


davis at pacific.mps.ohio-state.edu ("John E. Davis") writes:

>In article <1990Sep30.172917.2951 at Neon.Stanford.EDU> kanamori at Neon.Stanford.EDU (Atsushi Kanamori) writes:
>   >More usefully, "<" seems to be a more common idiom than "!=" in upward counting
>   >loops. So using "<" will probably shave a few microseconds off 
>   >the human reader's processing time.


>Which generates faster code?  It seems to me that it is easier to tell if two
>values are unequal than to tell if one is greater than the other.  I'd rather
>save the machine a few micro-seconds than myself since I only do the
>comparison once whereas the machine must do it many times.

You know what they say: "Computers are very good at doing things 
over and over and over again":-)

Shaving microseconds does not make better code. Better algorithms do.
(Definition of 'better' left to the reader as an exercise :-)

Tom.

-- 
I can be reached at...
  zougas at me.utoronto.ca || zougas at me.toronto.edu || ...!utai!me!zougas




More information about the Comp.lang.c mailing list