This is the mail archive of the
mailing list for the GDB project.
symbol table lookup performance
- To: gdb at sourceware dot cygnus dot com
- Subject: symbol table lookup performance
- From: jtc at redback dot com (J.T. Conklin)
- Date: 02 Jun 2000 16:49:00 -0700
- Reply-To: jtc at redback dot com
My users are again complaining about poor performance of user defined
functions, and again I've tracked it down to GDB's poor symbol table
lookup performance. I've got to finish my open projects before even
thinking about tackling symbol table optimization, but I did a quick
check to see if there was any low hanging fruit.
I profiled GDB, and determined that in running the script in question,
some 67% of the time is spent in lookup_partial_symbol(), and that 27%
of the time was spent in lookup_minimal_symbol().
I discovered that most of the calls to lookup_minimal_symbol() were
from fixup_section(), as it attempts to dig out section information
from the minimal symbols. But in this case most of the symbols being
"fixed up" were types (used in casts in the script) and therefore had
no section. Thus fixup_section() would call lookup_minimal_symbol()
again and again for the same type symbol.
I hacked in a change to fixup_symbol_section() that avoids calling
fixup_section() if sym->aclass == LOC_TYPEDEF. After that change, the
number of calls to lookup_minimal_symbol drops from 13753 to 2866; and
the time drops from 135 to 29 seconds.
Of course my users want much, much more than a 20% speed increase, but
it will have to do for now.
RCS file: /usr/rback/release/tools-src/gdb_ce_fe/gdb/gdb/symtab.c,v
retrieving revision 22.214.171.124
diff -c -r126.96.36.199 symtab.c
*** symtab.c 1999/07/15 18:46:07 188.8.131.52
--- symtab.c 2000/06/02 21:54:43
*** 558,563 ****
--- 564,572 ----
+ if (sym->aclass == LOC_TYPEDEF)
+ return sym;
if (SYMBOL_BFD_SECTION (sym))
Any thoughts on this change? It appears to work fine.