1

I've read it in some places that neovim is faster than vim, but many of these are a few year old blog posts and I haven't seen any actual comparisons (I'm not even sure how one could be reliable done though). Can somebody give me a rundown of what there is to know about this?

4
  • try both vim and neovim on your tasks and figure out what would be faster for your cases.
    – Maxim Kim
    Dec 13, 2021 at 16:40
  • 1
    Closing as opinion-based because, well, it depends... NeoVim and Vim largely share a lot of their code base, so for basic operations and built-ins they should be about the same... Many plug-in writers have praised NeoVim's adoption of Lua as main scripting language since it can be made much faster than Vimscript, as a result many NeoVim-only plug-ins can be pretty snappy... Perhaps a question discussing that particular point (plug-ins, due to backing language) could be made not to be too open ended. Feel free to edit if you think it's worth reopening as a more focused inquiry.
    – filbranden
    Dec 13, 2021 at 20:42
  • 1
    @filbranden I think I got a good enough overview actually :) The vimscript in vim9 vs lua could be interesting but definitely a separate question.
    – fbence
    Dec 14, 2021 at 8:34
  • So as it was said, this is really just for my setup, but using time vim +q and time nvim +q and also both with specifying -u NONE, banilla neovim has 25 ms startup and vanilla vim has 42 ms pretty reliably, while loading all my plugins takes 250 - 350 ms, but the deviance is pretty great so I'd say they are rather similar for startup. For usage, we'll see :)
    – fbence
    Dec 16, 2021 at 8:37

1 Answer 1

3

For most built-in operations, the runtime between Vim and NeoVim is not noticeably different. That is, both are fast enough to not care about any difference.

I've seen one situation that NeoVim is much better. If you have a big file and want to delete all lines matching a pattern, then you can do:

:g/pattern/d

In Vim, each matched line is deleted and saved to the default register. When repeating this many many times, it becomes significantly slow. The Vim workaround for faster performance is to delete to the the black hole register, _.

:g/pattern/d _

In NeoVim, this works fast even without specifying the black hole register. If you're going to save and re-save and re-save over and over again to the default register during a :g command, then you can speed it up by skipping all but the last one. That's probably what NeoVim is doing.

VimScript vs LuaJIT is the biggest speed difference though. NeoVim has a built-in LuaJIT compiler. Any existing plugin written in Vimscript will not necessarily run faster in NeoVim, but the plugin could be re-written in Lua (or even the faster Vimscript in Vim9) for faster performance.

1
  • vim9-script isn't supported currently in neovim
    – elig
    Jul 12, 2022 at 6:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.