hi,
i found several performance bottlenecks in BFD that led to poor performance of binutils.
1. the coff_section_from_bfd_index in coffgen.c always find the section from head of section list.
2. handle_COMDAT in coffcode.h always find COMDAT symbol from the first symbol
3. coff_compute_checksum in coffcode.h reads only 2 bytes each time
4. coff_amd64_rtype_to_howto/coff_i386_rtype_to_howto find section sequentially, it can be replaced with optimized coff_section_from_bfd_index
the attachment is the patch to binutils v2.40
ranlib a large (>500MB) library
v2.40: 15.1s
patched: 7.7s
strip a large library
v2.40: 7.1s
patched: 2.9s
create a large library with ar
v2.40: 6.9s
patched: 3.3s
link a executable with full debug symbols
v2.40: 241s
patched: 9.1s
link a executable without debug symbols
v2.40: 21.7s
patched: 7.8s