summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2017-06-05 16:05:00 -0300
committerdequis <dx@dxzone.com.ar>2017-06-05 18:10:27 -0300
commit0e44ea891645044f47bf3754e141045ee3b24324 (patch)
tree96c154eeea8b309f2fd253fbff7f15f56da13c27 /src
parent31b9d115b065570020ce9be1a1d8cd49212f70a9 (diff)
downloadirssi-0e44ea891645044f47bf3754e141045ee3b24324.zip
Performance improvements for /lastlog with big result sets
This applies to "/lastlog" with no filters (or with filters that don't filter a lot) and with large amounts of text in the scrollback. Test case: /exec seq 1 500000 /lastlog -file log.txt Thanks to morning for reporting this.
Diffstat (limited to 'src')
-rw-r--r--src/fe-text/textbuffer.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/fe-text/textbuffer.c b/src/fe-text/textbuffer.c
index 3668f4c7..fdb95451 100644
--- a/src/fe-text/textbuffer.c
+++ b/src/fe-text/textbuffer.c
@@ -616,21 +616,23 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
}
for (; pre_line != line; pre_line = pre_line->next)
- matches = g_list_append(matches, pre_line);
+ matches = g_list_prepend(matches, pre_line);
match_after = after;
}
if (line_matched || match_after > 0) {
/* matched */
- matches = g_list_append(matches, line);
+ matches = g_list_prepend(matches, line);
if ((!line_matched && --match_after == 0) ||
(line_matched && match_after == 0 && before > 0))
- matches = g_list_append(matches, NULL);
+ matches = g_list_prepend(matches, NULL);
}
}
+ matches = g_list_reverse(matches);
+
#ifdef USE_GREGEX
if (preg != NULL)
g_regex_unref(preg);