mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibGUI: Resize GUI::HeaderView section vector to final size immediately
When computing row & column sizes in AbstractTableView, it iterates across both axes starting from 0. This caused us to grow the corresponding HeaderView's internal section vector by 1 entry for each step, leading to Vector::resize() thrashing. Since we already know the final size, just resize to that immediately, and the thrashing goes away. This gives a huge speedup when loading large files into Profiler. :^)
This commit is contained in:
parent
c63761a341
commit
6387f65f87
Notes:
sideshowbarker
2024-07-18 18:10:44 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/6387f65f874
1 changed files with 4 additions and 2 deletions
|
@ -54,8 +54,10 @@ int HeaderView::section_size(int section) const
|
|||
|
||||
HeaderView::SectionData& HeaderView::section_data(int section) const
|
||||
{
|
||||
if (static_cast<size_t>(section) >= m_section_data.size())
|
||||
m_section_data.resize(section + 1);
|
||||
VERIFY(model());
|
||||
if (static_cast<size_t>(section) >= m_section_data.size()) {
|
||||
m_section_data.resize(section_count());
|
||||
}
|
||||
return m_section_data.at(section);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue