I have a big source code base on both Mac and Windows on which I work on this with MacVim/NeoVim. When using CTRL-] to search tag through a 1.6G tags file, I got immediate result with MacVim while surfering about 5s to get search result from NeoVim.

  1. How to profile this action CTRL-]? Vim profile seems need to call a function like profile func *, however I don't know the underneath callee functionname.
  2. Is there like a exe application called by action CTRL-], which causing such bad performance.

Any ideas to this problem?

NeoVim version is v0.4.3 MacVim version is 8.2 MacVim and NeoVim share the same vimrc. Source code base on both windows and mac are placed on SSD.

Finally I solved my problem by reducing (1.6GB->0.6GM) the size of the tags file which is thought to be the main cause. If your encountered similar problems as mine. You may fellow steps as below.

  1. make sure virus scanner is innocent
  2. check your vimrc, make sure tagbsearch and tagcase config are correct for binary tag searching.
  3. make sure only the information that you concerned remain in your tags file. try to use ctags.exe with --exclude={regex you want to ignore} or --languages={languages you want to ignore} to reduce the size of tags on windows. (wildcard * is only available when you see +wildcards in ctags.exe --version)

After all, NeoVim or gVim on windows seem have a lower threshold for the size of tags file than MacVim. When the threshold is bypassed, CTRL-] will become slow apparently.

  • Virus scanner would be my first guess.
    – Ralf
    Commented Apr 29, 2020 at 4:27
  • @Ralf I checked the windows task manager, which shows 80-90% CPU time is consumed by NeoVim process during tagging. Virus scanner seems have nothing to do with this issue.
    – Yukun Du
    Commented Apr 29, 2020 at 4:53

1 Answer 1


search tag through a 1.6G tags file, I got immediate result with MacVim while surfering about 5s to get search result from NeoVim.

From the symptoms you describe, it seems to me that you're getting binary search from MacVim while you're not getting it from NeoVim on Windows.

Binary search in the tags file is controlled by the 'tagbsearch' option, but I'd expect that to be enabled on both systems.

But for binary search to work, the tags file needs to be properly sorted, so there are other factors that can cause Vim to execute a linear search even when 'tagbsearch' is on.

One of the most frequent reasons why Vim would degrade to a linear search is if it's doing case-insensitive search on a tags file that wasn't generated with case folding (which would allow for a case-insensitive binary search.) If you're looking for a case-insensitive match, but the file has been sorted case-sensitively, you need to degrade back to linear search to find the matches with different case.

Tag case sensitive search is primarily controlled by the 'tagcase' option, but depending on the value of that option, it might also depend on whether 'ignorecase' or 'smartcase' are set. (By default, it depends on 'ignorecase'.)

You could try to :set tagcase=match to force case-sensitive search and see if that solves the problem right away.

Your tags file needs to be properly sorted for the binary search to succeed. If Vim is trying to perform binary search and, while doing so, encounters entries that are out of order, it might fallback to linear search. But in that case, Vim would issue an E432: Tags file not sorted warning. Since you didn't report seeing this warning, it seems this is not what's happening with you... (I'm betting on the tag case search, I once actually enabled that to fix an instance of this particular warning.)

Finally, make sure you're running the latest version of Vim/NeoVim on your machines. There was recently a bug that would break tag binary search on Vim/NeoVim. It got fixed on Vim 8.1.2152 and I believe NeoVim 0.4.3. The particular issue actually happened on Mac OS and it would trigger the E432 warning, so I don't think that explains what you're saying, but just in case it's related, you might want to make sure you're using a newer version of Vim/NeoVim where this bug has already been fixed.

  • 1
    Thank you very much for answering my question and giving a very good direction to solving this problem. I do as your instructions, and performace is still not satisfying. At last, I found some of my exclude files are still in the tags file. So I check the compiled features of my ctags.exe, and +wildcards feature is not compiled with. I downloaded a new one(github.com/universal-ctags/ctags) and reduce the size of the tags file to about 600MB, then everything seems perfect.
    – Yukun Du
    Commented Apr 29, 2020 at 7:46
  • 1
    @YukunDu I'm glad you got to fix it! Please post the part about tweaking your ctags.exe call to exclude the exclude files as an answer, since that part is likely to help others with a similar problem in the future. Thanks!
    – filbranden
    Commented Apr 29, 2020 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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