.gdb_index prod perf regression: Estimate size of psyms_seen
Using the same test as the previous patch, perf shows GDB spending
over 7% in "free". A substantial number of those calls comes from
insertions in the psyms_seen unordered_set causing lots of rehashing
and recreating buckets. Fix this by computing an estimate of the size
of the set upfront.
Using the same test as in the previous patch, against the same gdb
inferior, timing improves ~8% further:
~6.5s => ~6.0s (average of 5 runs).
gdb/ChangeLog:
2017-06-12 Pedro Alves <palves@redhat.com>
* dwarf2read.c (recursively_count_psymbols): New function.
(write_psymtabs_to_index): Call it to compute number of psyms and
pass estimate size of psyms_seen to unordered_set's ctor.