Page MenuHomePhabricator

Optimize fake ELF section lookup while parsing symbols in ObjectFileELF
Needs ReviewPublic

Authored by xiaobai on Dec 5 2017, 4:01 PM.

Details

Summary

I recently ran into a shared object that had a reasonably large number
of absolute symbols. Parsing all the symbols in the shared object took an
unusually long amount of time, so I looked into it and found that when we
created fake sections for these symbols, we would add them to the module's
section list without inserting it into the cache (section_name_to_section).
While this works, in some cases we perform a lookup of the section in that cache
almost right after we create it and put in the module section list.
Given I had a large amount of symbols that triggered this code path, performance
was abysmal. This change greatly improved performance there.

Event Timeline

xiaobai created this revision.Dec 5 2017, 4:01 PM
zturner edited edge metadata.Dec 5 2017, 4:03 PM

This could be tested by using lldb-test to dump the section cache and running FileCheck on it to make sure that all expected sections are cached.

Looks fine to me, but a test would be nice as Zach suggested. I am guessing before we made way too many sections. Should be easy to conjure up a test and verify the same sections is used.

labath resigned from this revision.Nov 26 2018, 2:59 AM
labath added a subscriber: labath.