mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 01:16:31 +00:00
perf(extmarks): don't handle inline virt_text if there is none (#24322)
Extreme testcase: ```lua vim.fn.setline(1, 'foobar') local ns = vim.api.nvim_create_namespace('') for _ = 1, 100000 do vim.api.nvim_buf_set_extmark(0, ns, 0, 3, {}) end local start_time = vim.loop.hrtime() vim.fn.virtcol('$') local stop_time = vim.loop.hrtime() print(stop_time - start_time) ``` Before #20130: 31696 On master branch: 26191344 After this PR: 37692
This commit is contained in:
@@ -329,7 +329,7 @@ void init_chartabsize_arg(chartabsize_T *cts, win_T *wp, linenr_T lnum, colnr_T
|
||||
cts->cts_has_virt_text = false;
|
||||
cts->cts_row = lnum - 1;
|
||||
|
||||
if (cts->cts_row >= 0) {
|
||||
if (cts->cts_row >= 0 && wp->w_buffer->b_virt_text_inline > 0) {
|
||||
marktree_itr_get(wp->w_buffer->b_marktree, cts->cts_row, 0, cts->cts_iter);
|
||||
mtkey_t mark = marktree_itr_current(cts->cts_iter);
|
||||
if (mark.pos.row == cts->cts_row) {
|
||||
|
Reference in New Issue
Block a user