From 9af2be292db3db7b28a6210263f719a6bbc4059f Mon Sep 17 00:00:00 2001 From: bfredl Date: Fri, 12 Jan 2024 14:38:18 +0100 Subject: perf(extmarks): add metadata for efficient filtering of special decorations This expands on the global "don't pay for what you don't use" rules for these special extmark decorations: - inline virtual text, which needs to be processed in plines.c when we calculate the size of text on screen - virtual lines, which are needed when calculating "filler" lines - signs, with text and/or highlights, both of which needs to be processed for the entire line already at the beginning of a line. This adds a count to each node of the marktree, for how many special marks of each kind can be found in the subtree for this node. This makes it possible to quickly skip over these extra checks, when working in regions of the buffer not containing these kind of marks, instead of before where this could just be skipped if the entire _buffer_ didn't contain such marks. --- src/nvim/buffer.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/nvim/buffer.h') diff --git a/src/nvim/buffer.h b/src/nvim/buffer.h index 4ad7144ad9..144573849c 100644 --- a/src/nvim/buffer.h +++ b/src/nvim/buffer.h @@ -81,3 +81,8 @@ static inline varnumber_T buf_get_changedtick(const buf_T *const buf) { return buf->changedtick_di.di_tv.vval.v_number; } + +static inline uint32_t buf_meta_total(const buf_T *b, MetaIndex m) +{ + return b->b_marktree->meta_root[m]; +} -- cgit