Current version of Dwarf parser uses object::RelocVisitor for applying relocations.
And do that in a bit wierd way. It creates object::RelocVisitor object
for each relocation, though could do it once for file and reduce amount of checks, which
now happens because of visit() function that still check file type on each call and then
chooses which arch to use in a huge single method with use of lots helper function.
I was interested would it be any benefit if we change code to select proper architecture
and file type once during visitor creation. And implemented it for ELF x86_64 in this patch.
Numbers for me are 16,5909 ( +- 0,16% ) vs 16,3406 ( +- 0,19% ) for 25 runs of linking
llc binary with lld and -gdb-index. Difference is not much: 1,015, or up to 1% it seems for total link time.
Though this approach helps to split huge method and cleanup implementation.
Interesting what other thinks about that.
Have you/could you try keeping the selection here, but using a switch over ObjToVisit.getType() rather than the if/else chain? (maybe that'll be easy enough to optimize & tidy things up rather than having to have the indirection through a function pointer.