a style question

Andy Glew aglew at crhc.uiuc.edu
Mon Oct 8 10:36:35 AEST 1990


>> Which ['x != 100' or 'x < 100' RHS] 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.
>
>I'm distressed by the emphasis on this question in quite a number of
>recent postings.  The question, though answerable for each specific
>machine, seems to me to be quite beside the point.

The emphasis on shaving nanoseconds comes mainly from readers of the
comp.arch group, to which the article was cross-posted.  Comp.arch
readers are concerned with how to build the fastest possible hardware,
and how to write compilers to produce the fastest possible code on
that hardware.  Ideally, of course, your compiler will generate a=b
tests (if they are faster) even though you write a<=b tests (assuming
that the compiler can prove equivalence).

--
Andy Glew, a-glew at uiuc.edu [get ph nameserver from uxc.cso.uiuc.edu:net/qi]



More information about the Comp.lang.c mailing list