Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(treesitter): incremental foldupdate #28417

Merged
merged 1 commit into from
Apr 21, 2024

Conversation

tomtomjhj
Copy link
Sponsor Contributor

Problem:
While the fold level computation is incremental, the evaluation of the foldexpr is done on the full buffer. Despite that the foldexpr reads from the cache, it can take tens of milliseconds for moderately big (10K lines) buffers.

Solution:
Track the range of lines on which the foldexpr should be evaluated.

Problem:
While the fold level computation is incremental, the evaluation of the
foldexpr is done on the full buffer. Despite that the foldexpr reads
from the cache, it can take tens of milliseconds for moderately big (10K
lines) buffers.

Solution:
Track the range of lines on which the foldexpr should be evaluated.
@clason clason merged commit 2b6c9bb into neovim:master Apr 21, 2024
29 checks passed
@tomtomjhj tomtomjhj deleted the incremental-foldupdate branch April 21, 2024 08:46
@justinmk
Copy link
Member

coverity warning:

*** CID 492676:  Null pointer dereferences  (NULL_RETURNS)
/src/nvim/lua/stdlib.c: 564 in nlua_foldupdate()
558         return 0;
559       }
560     
561       linenr_T start = (linenr_T)luaL_checkinteger(lstate, 2);
562       linenr_T end = (linenr_T)luaL_checkinteger(lstate, 3);
563     
>>>     CID 492676:  Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing a pointer that might be "NULL" "win" when calling "foldUpdate".
564       foldUpdate(win, start + 1, end);
565     
566       return 0;
567     }
568     
569     // Access to internal functions. For use in runtime/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants