forked from PsychoticNinja/irssi
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.
This commit is contained in:
parent
31b9d115b0
commit
0e44ea8916
@ -616,21 +616,23 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (; pre_line != line; pre_line = pre_line->next)
|
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;
|
match_after = after;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line_matched || match_after > 0) {
|
if (line_matched || match_after > 0) {
|
||||||
/* matched */
|
/* matched */
|
||||||
matches = g_list_append(matches, line);
|
matches = g_list_prepend(matches, line);
|
||||||
|
|
||||||
if ((!line_matched && --match_after == 0) ||
|
if ((!line_matched && --match_after == 0) ||
|
||||||
(line_matched && match_after == 0 && before > 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
|
#ifdef USE_GREGEX
|
||||||
if (preg != NULL)
|
if (preg != NULL)
|
||||||
g_regex_unref(preg);
|
g_regex_unref(preg);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user