Sort the visible list while traversing the physical row list. This halves the time needed to sort

svn path=/trunk/; revision=29738
This commit is contained in:
Kovarththanan Rajaratnam 2009-09-06 09:36:21 +00:00
parent 474f5930db
commit 8edec9be91
1 changed files with 1 additions and 21 deletions

View File

@ -840,20 +840,6 @@ packet_list_qsort_physical_compare_func(PacketListRecord **a, PacketListRecord *
return ret;
}
static gint
packet_list_qsort_visible_compare_func(PacketListRecord **a, PacketListRecord **b,
PacketList *packet_list)
{
gint ret;
g_assert((a) && (b) && (packet_list));
ret = ((*a)->visible_pos) < ((*b)->visible_pos) ? -1 :
((*a)->visible_pos) > ((*b)->visible_pos) ? 1 : 0;
return ret;
}
static void
packet_list_resort(PacketList *packet_list)
{
@ -886,6 +872,7 @@ packet_list_resort(PacketList *packet_list)
if (record->visible_pos >= 0) {
g_assert(record->fdata->flags.passed_dfilter);
neworder[vis_idx] = record->visible_pos;
PACKET_LIST_RECORD_GET(packet_list->visible_rows, vis_idx) = record;
record->visible_pos = vis_idx;
++vis_idx;
}
@ -893,13 +880,6 @@ packet_list_resort(PacketList *packet_list)
g_assert(vis_idx == PACKET_LIST_RECORD_COUNT(packet_list->visible_rows));
/* resort visible rows according to new physical order */
g_qsort_with_data(packet_list->visible_rows->pdata,
PACKET_LIST_RECORD_COUNT(packet_list->visible_rows),
sizeof(PacketListRecord*),
(GCompareDataFunc) packet_list_qsort_visible_compare_func,
packet_list);
path = gtk_tree_path_new();
gtk_tree_model_rows_reordered(GTK_TREE_MODEL(packet_list), path, NULL,