Re: gdb script performance

Daniel Jacobowitz
2006-10-05T15:37:16Z

On Thu, Oct 05, 2006 at 05:29:30PM +0200, Jean-Marc Saffroy wrote:
> On Thu, 5 Oct 2006, Daniel Jacobowitz wrote:
>
> >If you would like to see if further improvement is possible, you should
> >build a GDB with profiling enabled (--enable-profiling at configure
> >time), and use the maint set profile command to get a profile; then
> >post exact data from it.
>
> Please find attached gprof output (this is with gdb 6.5 +
> gdb-lookup-internal-first-3.patch running the lsmaps script I posted
> earlier).
>
> Thanks for helping!

26.14 381.31 381.31 141867 2.69 3.50 find_pc_sect_psymtab
18.54 651.82 270.51 331876 0.82 0.82 find_pc_sect_section
17.88 912.69 260.87 144847060 0.00 0.00 lookup_partial_symbol
11.01 1073.33 160.64 1254595136 0.00 0.00 strcmp_iw
4.98 1145.97 72.64 34010 2.14 16.50 lookup_symbol_aux_psymtabs
4.78 1215.73 69.75 9584 7.28 8.12 fixup_section
4.46 1280.79 65.06 lbasename
3.42 1330.64 49.85 12183 4.09 4.09 lookup_partial_symtab
1.83 1357.34 26.70 33844664 0.00 0.00 strcmp_iw_ordered
1.68 1381.82 24.48 1288426966 0.00 0.00 symbol_natural_name
1.09 1397.71 15.89 1288426966 0.00 0.00 symbol_search_name

Well then. Observations:
- We're looking up partial symbols way too often.
- It's taking way too long.
- And oh my lord is that a lot of calls to the (fairly inefficient)
strcmp_iw.

It looks like only about three calls to find_pc_sect_psymtab per
expression evaluation, which is bad but not too bad - sounds like
a last-searched-item cache may be useful.

(To be clear: I don't have time to work on this just now.)

--
Daniel Jacobowitz
CodeSourcery