Performance issues #5
Comments
I know, there are performance issues. I'm not experienced enough to fix them. I'm still trying to find the solution |
I test on latest coc.nvim, neovim and ts-rainbow, this issue still exist. |
I tested this properly, the slowdown is only when completion is enabled. I should've tested this the first time oof |
It looks like still slowdown many operations like move or edit in my environment. |
The same problems occurred while I edit a python file, but other file is ok. |
for me, the slow down happens in lua file. I found in lsp.log
don't know if it's relevant. I'm using nvim-lspconfig, treesitter, completion-nvim and ts-rainbow. |
i don't think it is relevant |
Guys it should be much better now (not completely fixed), please update and test |
This is still an issue. An example that makes it noticeable is editing this file with and without this plugin, specially in insert mode. |
Unfortunately currently I have no clue how to fix this |
That's quite a pathological example, don't you think…? |
1800 pairs hehe |
Yes, just to make the issue clear. Sometimes the CPU usage stays at 100% for several seconds. |
I do expierence the issue on a almost pure lua setup (using clangd) on editing a 500 LOC c++ file. @p00f Can you recommend a luajit profiler to identify the source? C-type languages are painful without colored brackets. EDIT: Or applying it every few seconds. |
See the ones mentioned here nvim-lua/wishlist#4 Yeah the idea is very good, I don't need to run everything whenever text changes |
I don't have time rn, I'll look into profiling after a week or so (I have zero prior experience). @matu3ba you can have a go! |
nvim-ts-rainbow/lua/rainbow/internal.lua Line 92 in 3557b7b
Currently it happens on every change |
The solution should distinguish between modes: In insertion mode one wants to redraw, if any bracket was inserted. If that wont be enough, we could also make it faster coloring by indexing and reverse iterating scopes to find what parts to redraw. But that would be notable complexity. |
idk how slow that is, |
I can try writing queries for just brackets and use |
Can you guys try out the |
@rodamaral i tested your |
the plugin cuased nvim stuck on related issue: neovim/neovim#14037 (comment) lot's of something like below if I use
|
This plugin won't work at all without nvim-treesitter though, it's a module for nvim-treesitter. nvim-ts-rainbow/lua/rainbow.lua Line 2 in 35e971a
nvim-ts-rainbow/lua/rainbow.lua Line 1 in 35e971a
(sorry for the tag mjlbach, I edited it) (Now that you are here, can you test the |
Not quickly enough ❤️ |
Just for the record I did not suggest removing tree-sitter lol |
@p00f that comment is not accurate. please check the last two comments |
@p00f but the CPU will goes down very qucikly. |
@p00f If I use packer.nvim with -- treesitter
use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' }
use { 'nvim-treesitter/nvim-treesitter-refactor' } --TODO setup
use { 'nvim-treesitter/playground' } --inspecting treesitter data: :TSPlaygroundToggl
use { 'p00f/nvim-ts-rainbow', branch = 'query_iter_captures' } --TODO performance problem -- I cant get my c++ file colorized to investigate. However, it works with the master branch. require'nvim-treesitter.configs'.setup {
ensure_installed = "maintained",
highlight = {
enable = true,
},
rainbow = {
enable = true,
},
} What am I missing? PS: Sorry for the missing reply yesterday. |
oh yeah i forgot to tell you, you have to write queries for each filetype. Just save |
nvm i did that since it had to be done anyway, please update and try |
@p00f It has much better performance, which is sufficient for 1k LOC and 110 brackets. The delay difference with and without rainbow is still noticable with and without rainbow, but the file size/number of brackets has not a noticable effect anymore.
|
There have been no lsp regressions. If anything, it should be faster now. |
Great, I'll merge the new branch after writing queries for all languages 😄 . I'll still keep this open |
merged #11 |
Performance is much better now, even in my previous file. Thanks for the efforts! |
I'm using nvim-compe and it's lagging for me. If I set |
@TornaxO7 What is the size of the file? You can run my command for all bracket types: Are you on latest master neovim with updated treesitter? There were breaking changes in treesitter, which may not have stabilized. Does |
Currently I'm coding in C and this is in
grep -o '{' FILE | wc -l Output:
find FILE -type f -exec wc -l {} + | sort -rn. output:
My plugins should be up to date. I executed |
Here's a little live demo: Video.mp4As you can see, if I turn off rainbow neovim runs smoother. |
Please update and test, imo this can be closed (I might have broken some queries so please try to test as many languages as you can 🙂 ) |
For me, it's faster now as well! Thank you for the fix :) |
Nice! Thanks to theHamsta and tzachar |
When I enable this plugin and type words, coc's auto completion become very slow and broken. After this, cursor moving also get lag. When I disable it, every thing works well.
The text was updated successfully, but these errors were encountered: