1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:07:36 +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

@ -189,7 +189,7 @@ public:
template<VoidFunction<ProgramHeader> F>
void for_each_program_header(F) const;
Optional<Section> lookup_section(String const& name) const;
Optional<Section> lookup_section(StringView const& name) const;
bool is_executable() const { return header().e_type == ET_EXEC; }
bool is_relocatable() const { return header().e_type == ET_REL; }
@ -199,7 +199,7 @@ public:
FlatPtr base_address() const { return (FlatPtr)m_buffer; }
size_t size() const { return m_size; }
Optional<Symbol> find_demangled_function(const String& name) const;
Optional<Symbol> find_demangled_function(const StringView& name) const;
bool has_symbols() const { return symbol_count(); }
String symbolicate(u32 address, u32* offset = nullptr) const;