handle_movecursor callback was calling update_cursor() with redraw=TRUE on every cursor move inside vterm_input_write(). This triggered gui_mch_flush() (GdiFlush + DWriteContext_Flush) and TextChangedT autocmd for each cursor move. ConPTY output contains ~17 cursor positioning sequences per 4KB chunk, each flush taking ~5ms, resulting in 80-110ms per chunk.
Fix by passing FALSE to update_cursor() in handle_movecursor since write_to_term() already calls update_cursor() with proper redraw after vterm_input_write() finishes.
Also set vterm_screen_set_damage_merge() to VTERM_DAMAGE_SCROLL so that damage callbacks are buffered until vterm_screen_flush_damage() instead of being emitted per cell.
vterm_input_write profiling (per 4KB chunk):
| Before | After | Improvement | |
|---|---|---|---|
| vterm_input_write | 80-110ms | 0.7-1.1ms | ~100x |
Benchmark: 24-line :terminal running dir /s C:\Windows\System32:
| Before | After | Improvement | |
|---|---|---|---|
| vim.exe (TUI) | 18.73s | 18.55s | (noise) |
| gvim.exe (GUI) | 68.77s | 9.24s | -87% |
Closes #19845
https://github.com/vim/vim/pull/19846
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
thanks
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()