On Fri, 16 Aug 2002, Cliff Woolley wrote:

> On Fri, 16 Aug 2002, Ian Holsman wrote:
> 
> > I'm just wondering if there is any kind of measureable performance
> > benefit in keeping these as a macro vs putting them in a  function
> > (possibly inline if the compiler can support it).
> 
> I'm quite sure there is a performance benefit, though admittedly I don't
> have numbers on hand to support that at the moment.
> 
> It's as simple as this: many of the operations, once you get rid of the
> typecasts and other noise, optimize down to just a few adds/subtracts and
> a few assignments.  Four lines of code in most cases.  Adding the overhead
> of a function call (actually probably two or three function calls) for
> each operation would be substantial.
> 
> It just looks messy when you expand the macros because it all gets
> squished on one line and because lots of noise gets shoved in.  But you
> could say that about most macros when read in fully expanded form.

I agree 100%.  These macros are relatively simple, just doing a bunch of
casting and pointer manipulation.  The cost of putting those in functions
would most likely be very high.  A better question IMHO, is whether any of
those macros can be made less complex.

Ryan

_______________________________________________________________________________
Ryan Bloom                              [EMAIL PROTECTED]
550 Jean St
Oakland CA 94610
-------------------------------------------------------------------------------

Reply via email to