mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +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:
parent
35a97884aa
commit
5bfba3f789
5 changed files with 12 additions and 12 deletions
|
@ -271,7 +271,7 @@ Optional<Image::RelocationSection> Image::Section::relocations() const
|
|||
return static_cast<RelocationSection>(relocation_section.value());
|
||||
}
|
||||
|
||||
Optional<Image::Section> Image::lookup_section(const String& name) const
|
||||
Optional<Image::Section> Image::lookup_section(const StringView& name) const
|
||||
{
|
||||
VERIFY(m_valid);
|
||||
for (unsigned i = 0; i < section_count(); ++i) {
|
||||
|
@ -288,7 +288,7 @@ StringView Image::Symbol::raw_data() const
|
|||
return { section.raw_data() + (value() - section.address()), size() };
|
||||
}
|
||||
|
||||
Optional<Image::Symbol> Image::find_demangled_function(const String& name) const
|
||||
Optional<Image::Symbol> Image::find_demangled_function(const StringView& name) const
|
||||
{
|
||||
Optional<Image::Symbol> found;
|
||||
for_each_symbol([&](const Image::Symbol& symbol) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue