UI: Only sort visible packets instead of all packets

Previously, Wireshark was sorting all packets in a capture,
regardless whether they were actually visible or not. If you
are working with large PCAPs & filters, this is a MASSIVE
performance drag. Therefore, this commit changes this
by only sorting the visible packets which boosts the
sorting performance in filtered views massively.
This commit is contained in:
Nils Hanke 2022-04-29 13:58:22 -07:00 committed by Roland Knall
parent fe4b063954
commit 34a66401e8
1 changed files with 3 additions and 2 deletions

View File

@ -366,12 +366,13 @@ void PacketListModel::sort(int column, Qt::SortOrder order)
busy_timer_.start();
sort_column_is_numeric_ = isNumericColumn(sort_column_);
std::sort(physical_rows_.begin(), physical_rows_.end(), recordLessThan);
QVector<PacketListRecord *> sorted_visible_rows_ = visible_rows_;
std::sort(sorted_visible_rows_.begin(), sorted_visible_rows_.end(), recordLessThan);
beginResetModel();
visible_rows_.resize(0);
number_to_row_.fill(0);
foreach (PacketListRecord *record, physical_rows_) {
foreach (PacketListRecord *record, sorted_visible_rows_) {
frame_data *fdata = record->frameData();
if (fdata->passed_dfilter || fdata->ref_time) {