[RuntimeDyld] Fix performance problem in resolveRelocations with many sections
authorKeno Fischer <kfischer@college.harvard.edu>
Sat, 10 Oct 2015 05:37:02 +0000 (05:37 +0000)
committerKeno Fischer <kfischer@college.harvard.edu>
Sat, 10 Oct 2015 05:37:02 +0000 (05:37 +0000)
commit8cc8b247d643b4324c503d36b674b8344e4245b8
treec23bd5aafda65f4a1d90ab917e845a970141cbba
parent66e7bb88cc00169ac72695a37b196cf51056f311
[RuntimeDyld] Fix performance problem in resolveRelocations with many sections

Summary:
Rather than just iterating over all sections and checking whether we have relocations for them, iterate over the relocation map instead. This showed up heavily in an artificial julia benchmark that does lots of compilation. On that particular benchmark, this patch gives
~15% performance improvements. As far as I can tell the primary reason why the original
loop was so expensive is that Relocations[i] actually constructs a relocationList (allocating memory & doing lots of other unnecessary computing) if none is found.

Reviewers: lhames

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D13545

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249942 91177308-0d34-0410-b5e6-96231b3b80d8
lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp