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.
This commit is contained in:
bfredl
2022-06-08 22:02:02 +02:00
parent b2ed439bd5
commit 5d69872105
22 changed files with 614 additions and 271 deletions

View File

@@ -11,10 +11,6 @@
# include "msgpack_rpc/unpacker.c.generated.h"
#endif
#define kv_fixsize_arena(a, v, s) \
((v).capacity = (s), \
(v).items = (void *)arena_alloc(a, sizeof((v).items[0]) * (v).capacity, true))
Object unpack(const char *data, size_t size, Error *err)
{
Unpacker unpacker;