mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-08 18:46:03 +00:00
LibDebug: Avoid unnecessary String allocation in append_to_line_info()
This code path is very hot, and since we're seeing a lot of the same strings repeatedly (and they're heading into a FlyString for storage) let's construct those using FlyString(StringView) to avoid temporary String objects.
This commit is contained in:
parent
a4099fc756
commit
08c55b7606
Notes:
sideshowbarker
2024-07-18 18:06:55 +09:00
Author: https://github.com/awesomekling
Commit: 08c55b7606
1 changed files with 2 additions and 2 deletions
|
@ -130,14 +130,14 @@ void LineProgram::append_to_line_info()
|
|||
if (m_file_index >= m_source_files.size())
|
||||
return;
|
||||
|
||||
String directory = m_source_directories[m_source_files[m_file_index].directory_index];
|
||||
auto const& directory = m_source_directories[m_source_files[m_file_index].directory_index];
|
||||
|
||||
StringBuilder full_path(directory.length() + m_source_files[m_file_index].name.length() + 1);
|
||||
full_path.append(directory);
|
||||
full_path.append('/');
|
||||
full_path.append(m_source_files[m_file_index].name);
|
||||
|
||||
m_lines.append({ m_address, full_path.to_string(), m_line });
|
||||
m_lines.append({ m_address, FlyString { full_path.string_view() }, m_line });
|
||||
}
|
||||
|
||||
void LineProgram::reset_registers()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue