-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
As Daniel pointed out, appends to region_highlight might be expensive. This reminded me coding https://github.com/psprint/zsh-morpho, where I used associative array indexed with integers instead of regular array. The image and needed array size is $LINES * $COLUMNS, say 6903 on my current terminal, which is not very large size, and when I compared hash vs array runs, it basically meant that with arrays one could go get a coffee multiple times. Maybe I'll provide numbers, but for hash it was ~7 seconds.
So, if highlighters would keep integer index=1, store at it into hash and increment, and then at the end move entries from hash into region_highlight at one go, this should improve performance.
PS. I checked region_highlight size produced by main-highlighter.zsh when parsing itself (754 lines), and its 686 entries, so not close to 6903, however we still might get 100 ms or more, which counts for zsyh-enabled vared and say 500 line functions edited with it (I already enable zsyh for vared).