This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: [RFC] Notes on QUIT and STREQ et.al.
- To: Kevin Buettner <kevinb at cygnus dot com>
- Subject: Re: [RFC] Notes on QUIT and STREQ et.al.
- From: jtc at redback dot com (J.T. Conklin)
- Date: 13 Mar 2000 11:50:01 -0800
- Cc: Andrew Cagney <ac131313 at cygnus dot com>, GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- References: <38CCC819.1071F28E@cygnus.com> <1000313162754.ZM28984@ocotillo.lan>
- Reply-To: jtc at redback dot com
>>>>> "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