Attribute method inlining
authorTom Tromey <tromey@adacore.com>
Wed, 27 May 2020 17:48:18 +0000 (11:48 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 27 May 2020 17:48:18 +0000 (11:48 -0600)
commit697bba18273d3a03f9093a94cf3e1d75012905f3
tree65dc74d932cbb53e4cacb55bc26e8db803a0d0a2
parentc17ace4397c73bcdeb616f1b854a1cf8a8b6579c
Attribute method inlining

This inlines a couple of methods on struct attribute, improving the
performance of DWARF partial symbol reading.  These methods were
discovered as hot spots using callgrind.

For this patch, and for all the patches in this series, I tested gdb's
performance on three programs:

1. gdb itself -- I built gdb and copied it to /tmp, ensuring that the
   same version was used in all tests.

2. The system libxul.so, the main library of Firefox.  I installed the
   separate debuginfo and ensured that gdb read it.

3. A large-ish Ada program that I happen to have.

I ran gdb 10 times like:

  /bin/time -f %e \
    ./gdb/gdb --data-directory ./gdb/data-directory -nx \
    -iex 'set debug-file-directory /usr/lib/debug' \
    -batch $X

... where $X was the test executable.  Then I computed the mean time.
This was all done with a standard (-g -O2) build of gdb.

The baseline times were

gdb    1.90
libxul 2.12
Ada    2.61

This patch brings the numbers down to

gdb    1.88
libxul 2.11
Ada    2.60

Not a huge change, but still visible in the results.

gdb/ChangeLog
2020-05-27  Tom Tromey  <tromey@adacore.com>

* dwarf2/attribute.h (struct attribute) <form_is_ref>: Inline.
<get_ref_die_offset>: Inline.
<get_ref_die_offset_complaint>: New method.
* dwarf2/attribute.c (attribute::form_is_ref): Move to header.
(attribute::get_ref_die_offset_complaint): Rename from
get_ref_die_offset.  Just issue complaint.
gdb/ChangeLog
gdb/dwarf2/attribute.c
gdb/dwarf2/attribute.h
This page took 0.024991 seconds and 4 git commands to generate.