Path: utzoo!attcan!uunet!maverick.ksu.ksu.edu!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!aglew From: aglew@crhc.uiuc.edu (Andy Glew) Newsgroups: comp.lang.c Subject: Re: a style question Message-ID: Date: 8 Oct 90 00:36:35 GMT References: <7341@darkstar.ucsc.edu> <1990Sep30.050655.13212@zoo.toronto.edu> <1990Sep30.172917.2951@Neon.Stanford.EDU> <1990Oct2.151644.1581@phri.nyu.edu> <1275.270afcdb@iccgcc.decnet.ab.com> Sender: news@ux1.cso.uiuc.edu (News) Organization: Center for Reliable and High-Performance Computing University of Illinois at Urbana Champaign Lines: 20 In-Reply-To: browns@iccgcc.decnet.ab.com's message of 4 Oct 90 14:11:52 GMT >> 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@uiuc.edu [get ph nameserver from uxc.cso.uiuc.edu:net/qi]