This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFC] Notes on QUIT and STREQ et.al.


>>>>> "Kevin" == Kevin Buettner <kevinb@cygnus.com> writes:
Kevin> I haven't looked to see how often (or where) STREQ and STRCMP are
Kevin> used, but these macros compare the first characters inline in an
Kevin> attempt to improve performance.  Have you assessed the benefits of
Kevin> doing this?  (If these optimizations significantly improve
Kevin> performance, I think they should stay.)

I've found attempts to increase performance don't always accomplish
what they set out to do.  Testing the first characters inline avoids
function call overhead at the expense of increased code size.  If it
ends up thrashing the icache, overall performance could actually
signifcantly decrease.

Kevin> It seems to me that a decent STREQ macro should also test to see
Kevin> if the pointers are equal.  I.e,
Kevin>
Kevin>    #define STREQ(a,b) ((a == b) || (*(a) == *(b) ? !strcmp ((a), (b)) : 0))

Only if you expect that comparing identical strings has a high likelyhood.

        --jtc

-- 
J.T. Conklin
RedBack Networks

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]