summaryrefslogtreecommitdiffstats
path: root/mutt_curses.h
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2021-03-10 15:09:49 -0800
committerKevin McCarthy <kevin@8t8.us>2021-03-11 14:08:56 -0800
commit53ffdb93b8a96efb7456f9430cf46a66ca7b9860 (patch)
treea1aa5b93686758728c315f6a607597effe47e07d /mutt_curses.h
parent17774247f68cd6f60b14a5c033afbd2ef42743f8 (diff)
Improve body color matching speed by caching future matches.
On a *very* long body (or header_partial) lines with multiple color lines that match, performance can be degraded. For instance if there were moderately expensive regexp matches against "A" "B" and "C". A line with: A A A A A B A A C A A A B A A A C The B and C regexps were scanned again after every "A" match, despite that the result would be discarded again for the next A match. Change the color matching to cache the location of each color line match. Discard the cache once the match offset passes that point.
Diffstat (limited to 'mutt_curses.h')
-rw-r--r--mutt_curses.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/mutt_curses.h b/mutt_curses.h
index d6f14d7c..e7c85b13 100644
--- a/mutt_curses.h
+++ b/mutt_curses.h
@@ -154,9 +154,14 @@ typedef struct color_line
int pair;
struct color_line *next;
+ regoff_t cached_rm_so;
+ regoff_t cached_rm_eo;
+
unsigned int stop_matching : 1; /* used by the pager for body patterns,
to prevent the color from being retried
once it fails. */
+ unsigned int cached : 1; /* indicates cached_rm_so and cached_rm_eo
+ * hold the last match location */
} COLOR_LINE;
#define MUTT_PROGRESS_SIZE (1<<0) /* traffic-based progress */