mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:37:45 +00:00
LibDebug: Pre-allocate capacity for the LineProgram::LineInfo vector
This shaves another ~15% off of "bt 12" on my machine :^)
This commit is contained in:
parent
0bf3df28b9
commit
4f4cde2379
1 changed files with 4 additions and 1 deletions
|
@ -103,6 +103,8 @@ void DebugInfo::prepare_lines()
|
||||||
return file_path;
|
return file_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
m_sorted_lines.ensure_capacity(all_lines.size());
|
||||||
|
|
||||||
for (auto const& line_info : all_lines) {
|
for (auto const& line_info : all_lines) {
|
||||||
auto it = memoized_full_paths.find(line_info.file);
|
auto it = memoized_full_paths.find(line_info.file);
|
||||||
if (it == memoized_full_paths.end()) {
|
if (it == memoized_full_paths.end()) {
|
||||||
|
@ -111,8 +113,9 @@ void DebugInfo::prepare_lines()
|
||||||
}
|
}
|
||||||
if (!it->value.has_value())
|
if (!it->value.has_value())
|
||||||
continue;
|
continue;
|
||||||
m_sorted_lines.append({ line_info.address, it->value.value(), line_info.line });
|
m_sorted_lines.unchecked_append({ line_info.address, it->value.value(), line_info.line });
|
||||||
}
|
}
|
||||||
|
|
||||||
quick_sort(m_sorted_lines, [](auto& a, auto& b) {
|
quick_sort(m_sorted_lines, [](auto& a, auto& b) {
|
||||||
return a.address < b.address;
|
return a.address < b.address;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue