1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:48:13 +00:00

LibELF + LibDebug: Reduce allocations during symbolification

Avoid promotion of static strings to AK::String, instead use
AK::StringView and operator ""sv, to force string view's instead
which avoids allocation of String. This code path isn't hot enough
that it makes a huge difference, but every bit counts.
This commit is contained in:
Brian Gianforcaro 2021-05-30 23:44:02 -07:00 committed by Ali Mohammad Pur
parent 35a97884aa
commit 5bfba3f789
5 changed files with 12 additions and 12 deletions

View file

@ -13,15 +13,15 @@ namespace Debug::Dwarf {
DwarfInfo::DwarfInfo(const ELF::Image& elf)
: m_elf(elf)
{
m_debug_info_data = section_data(".debug_info");
m_abbreviation_data = section_data(".debug_abbrev");
m_debug_strings_data = section_data(".debug_str");
m_debug_line_strings_data = section_data(".debug_line_str");
m_debug_info_data = section_data(".debug_info"sv);
m_abbreviation_data = section_data(".debug_abbrev"sv);
m_debug_strings_data = section_data(".debug_str"sv);
m_debug_line_strings_data = section_data(".debug_line_str"sv);
populate_compilation_units();
}
ReadonlyBytes DwarfInfo::section_data(const String& section_name) const
ReadonlyBytes DwarfInfo::section_data(const StringView& section_name) const
{
auto section = m_elf.lookup_section(section_name);
if (!section.has_value())