From 34a66401e8e61a0b1b6d2d1fae39408f563a45f0 Mon Sep 17 00:00:00 2001 From: Nils Hanke Date: Fri, 29 Apr 2022 13:58:22 -0700 Subject: [PATCH] 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. --- ui/qt/models/packet_list_model.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/qt/models/packet_list_model.cpp b/ui/qt/models/packet_list_model.cpp index 659f01144d..9bac4dca5d 100644 --- a/ui/qt/models/packet_list_model.cpp +++ b/ui/qt/models/packet_list_model.cpp @@ -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 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) {