mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 14:05:15 +00:00
LibDebug: Avoid creating the String("serenity/") a bazillion times
We were creating and destroying this string twice for every LineInfo. That's a lot of malloc() and free() during UE startup.
This commit is contained in:
parent
fe7036d8f4
commit
4eb3cf68b7
Notes:
sideshowbarker
2024-07-19 01:22:34 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/4eb3cf68b7b
1 changed files with 4 additions and 2 deletions
|
@ -115,12 +115,14 @@ void DebugInfo::prepare_lines()
|
||||||
all_lines.append(program.lines());
|
all_lines.append(program.lines());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String serenity_slash("serenity/");
|
||||||
|
|
||||||
for (auto& line_info : all_lines) {
|
for (auto& line_info : all_lines) {
|
||||||
String file_path = line_info.file;
|
String file_path = line_info.file;
|
||||||
if (file_path.contains("Toolchain/") || file_path.contains("libgcc"))
|
if (file_path.contains("Toolchain/") || file_path.contains("libgcc"))
|
||||||
continue;
|
continue;
|
||||||
if (file_path.contains("serenity/")) {
|
if (file_path.contains(serenity_slash)) {
|
||||||
auto start_index = file_path.index_of("serenity/").value() + String("serenity/").length();
|
auto start_index = file_path.index_of(serenity_slash).value() + serenity_slash.length();
|
||||||
file_path = file_path.substring(start_index, file_path.length() - start_index);
|
file_path = file_path.substring(start_index, file_path.length() - start_index);
|
||||||
}
|
}
|
||||||
m_sorted_lines.append({ line_info.address, file_path, line_info.line });
|
m_sorted_lines.append({ line_info.address, file_path, line_info.line });
|
||||||
|
|
Loading…
Add table
Reference in a new issue