]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - bfd/elf.c
Optimize the performance of the group_setup function.
authorJens Widell <jl@opera.com>
Fri, 12 Jan 2018 13:16:17 +0000 (13:16 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 12 Jan 2018 13:16:17 +0000 (13:16 +0000)
commit564e11c9a9d9570b233b38cd995f1b4eb7c757e8
tree3282d9d08f64efc2e2f10ba13f89f3552b366050
parentb5b62006522c6d8d42028754bb1be165f00fe210
Optimize the performance of the group_setup function.

When processing a section that is a member of a group, the group
that contains it is looked up using a linear search. The resulting
O(n^2) complexity causes significant performance issues when
dealing with object files with very many groups.

By remembering the index of the last found group and restarting
the next search from that index, the search instead becomes O(n)
in common cases.

* elf.c (setup_group): Optimize search for group by remembering
last found group and restarting search at that index.
* elf-bfd.h (struct elf_obj_tdata): Add group_search_offset field.
bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf.c