diff options
author | Peter Wu <peter@lekensteyn.nl> | 2018-07-04 21:53:53 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-07-06 07:24:46 +0000 |
commit | c40c26c04c6a39ef7867a35c50293c666255c9a4 (patch) | |
tree | 2a29719dcd64d6b6646d6a6b1233255c16863afc /ui | |
parent | 2d36c475f985e0499431ffb93bc65c8738370549 (diff) |
Follow Stream: ensure linear performance with many packets
Reverse the payload chunks list to achieve a running time of O(n) rather
than O(n²) for insertion of all chunks. Executing a RelWithDebInfo+ASAN
build with `tshark -r chargen-session.pcapng.gz -qz follow,tcp,hex,0`
previously took 11m5s to complete, but now finishes in 16 seconds.
Tested using a capture file with 152k TCP packets (from bug 11777).
Backport note: must update ui/gtk/follow_stream.c too.
Change-Id: Icf70d45f33d4399e53209fb6199d3809608c8d99
Reviewed-on: https://code.wireshark.org/review/28595
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/cli/tap-follow.c | 4 | ||||
-rw-r--r-- | ui/qt/follow_stream_dialog.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/ui/cli/tap-follow.c b/ui/cli/tap-follow.c index e00cdcd217..f1a574224d 100644 --- a/ui/cli/tap-follow.c +++ b/ui/cli/tap-follow.c @@ -184,9 +184,9 @@ static void follow_draw(void *contextp) else printf("Node 1: %s:%u\n", buf, follow_info->server_port); - for (cur = follow_info->payload, chunk = 1; + for (cur = g_list_last(follow_info->payload), chunk = 1; cur != NULL; - cur = g_list_next(cur), chunk++) + cur = g_list_previous(cur), chunk++) { follow_record = (follow_record_t *)cur->data; if (!follow_record->is_server) { diff --git a/ui/qt/follow_stream_dialog.cpp b/ui/qt/follow_stream_dialog.cpp index a43b382725..7f79e6a67e 100644 --- a/ui/qt/follow_stream_dialog.cpp +++ b/ui/qt/follow_stream_dialog.cpp @@ -1004,7 +1004,7 @@ FollowStreamDialog::readFollowStream() elapsed_timer.start(); - for (cur = follow_info_.payload; cur; cur = g_list_next(cur)) { + for (cur = g_list_last(follow_info_.payload); cur; cur = g_list_previous(cur)) { if (dialogClosed()) break; follow_record = (follow_record_t *)cur->data; |