AckslD / muren.nvim

Multiple replacements in neovim
361 stars 4 forks source link

Very slow performance on large repos #35

Open dudicoco opened 7 months ago

dudicoco commented 7 months ago

When attempting to search replace across a large repository the plugin takes forever, listing each file it iterates over very slowly.

It seems that it is currently unusable with large repositories.

AckslD commented 7 months ago

Yeah this can be indeed, something you can try at least is to disable the preview which can be annoying if it's slow while you're typing things. Other than that I think the only solution would be to move the actual search and replace to an external program, maybe sed or a some custom program. Currently it's all done through nvim functions and commands.

Maybe one question, do you have any feeling for if it's slower compared to if you would have done the same search and replace manually through nvim. And if yes, what commands did you use?

dudicoco commented 7 months ago

usually I would do such search and replace via telescope which uses fd for searching (very fast) and then use native vim cfdo/cdo %s.

AckslD commented 7 months ago

And that's faster? If so, I wonder if it would be faster if muren would use cfdo instead of looping over the buffers to apply the search and replace in lua. However that was not what my intuition said when first writing it.

dudicoco commented 7 months ago

@AckslD the issue occurs in the search phase, before performing the actual replacement. perhaps muren should use fd and rg to search?

AckslD commented 7 months ago

I see, yeah currently muren uses :vimgrep to find the relevant files to do the search-replace operation on. This is such that vim-pattern syntax can be used. But maybe this should be configurable/toggleble? It could then use :grep instead and the user can configure whichever grepprg they want.

dudicoco commented 7 months ago

sounds like a good solution.