aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lib
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-06-08 22:02:02 +0200
committerbfredl <bjorn.linse@gmail.com>2022-06-20 12:44:56 +0200
commit5d6987210578f5f1c3151988b99a9411f9603374 (patch)
treec8d1b70ef948a4beafe82195431f1c6607fbe8b7 /src/nvim/lib
parentb2ed439bd5ab1b431bb61f8754554c48453495c5 (diff)
downloadrneovim-5d6987210578f5f1c3151988b99a9411f9603374.tar.gz
rneovim-5d6987210578f5f1c3151988b99a9411f9603374.tar.bz2
rneovim-5d6987210578f5f1c3151988b99a9411f9603374.zip
perf(ui): reduce allocation overhead when encoding "redraw" events
Note for external UIs: Nvim can now emit multiple "redraw" event batches before a final "flush" event is received. To retain existing behavior, clients should make sure to update visible state at an explicit "flush" event, not just the end of a "redraw" batch of event. * Get rid of copy_object() blizzard in the auto-generated ui_event layer * Special case "grid_line" by encoding screen state directly to msgpack events with no intermediate API events. * Get rid of the arcane notion of referring to the screen as the "shell" * Array and Dictionary are kvec_t:s, so define them as such. * Allow kvec_t:s, such as Arrays and Dictionaries, to be allocated with a predetermined size within an arena. * Eliminate redundant capacity checking when filling such kvec_t:s with values.
Diffstat (limited to 'src/nvim/lib')
-rw-r--r--src/nvim/lib/kvec.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nvim/lib/kvec.h b/src/nvim/lib/kvec.h
index 4238088b1c..b5b3adf7d2 100644
--- a/src/nvim/lib/kvec.h
+++ b/src/nvim/lib/kvec.h
@@ -121,6 +121,9 @@
#define kv_push(v, x) \
(*kv_pushp(v) = (x))
+#define kv_pushp_c(v) ((v).items + ((v).size++))
+#define kv_push_c(v, x) (*kv_pushp_c(v) = (x))
+
#define kv_a(v, i) \
(*(((v).capacity <= (size_t)(i) \
? ((v).capacity = (v).size = (i) + 1, \