xolox / vim-easytags

Automated tag file generation and syntax highlighting of tags in Vim
http://peterodding.com/code/vim/easytags/
1.01k stars 109 forks source link

Scrolling down in a file with Tag Highlighting on causes lag #64

Open reportados123 opened 11 years ago

reportados123 commented 11 years ago

Hi, I really like vim-easytags and just started using it, but I'm getting abnormal amounts of lag when I'm scrolling down a medium long file (160 lines). After scrolling down a bit, I start to get lag on vim. I'm using both gvim and vim, and the lag occurs on both.

I noticed it after I added another tag, called SDL2, which is basically a tags of SDL2, however, the size of the tag is only 1.6MB. And my project file tag is only 24KB. It shouldn't really give me lag should it? It's only 1.6 MB compared to +50 MB.

My settings related to this is:

let g:easytags_dynamic_files = 2 let g:easytags_python_script = "~/.vim/bundle/vim-easytags/misc/easytags/why-so-slow.py" set tags+=~/.vim/tags/sdl2

I disabled every plugin I have and it's easytags that's causing this. I tried not using python script and tried using highlight.py instead, but nothing different happens.

Is there a way I can fix this? Surely 1.6 MB can't be too much can it?

reportados123 commented 11 years ago

Yeah, I tried to minimize the SDL tag and I got it to 444 KB, and the lag was somewhat gone, it was 50% better, but the lag is still somewhat noticeable. I guess the highlighting or parsing is causing the slowdown. Is there a way to fix this?

reportados123 commented 11 years ago

Yeah, so I can load big tag files that are past 1MB easily, but the highlighting causes my vim to lag. I have "let g:easytags_auto_highlight = 0" set temporarily until the problem has been fixed. It's really a shame that I can't have better syntax highlighting with minimal lag. I mean, this lag isn't even tolerable. When I scroll down with my cursor and it sees a lot of things to highlight, it just completely lags out. Even if I'm at a spot that has a lot of things to highlight and and I scroll down 1 line, the lag is still there. It doesn't matter how fast I go or not.

And I'm not even using tags on a network, everything's locally available. Is there something I'm missing? Surely a tags that's a megabyte in size can't possibly be this bad. Is there anything I can do?

All I want is some confirmation or something, thanks. At the very least, is there a way I can enable highlighting for a specific tag? I have multiple tags, one is the project one and the other is the SDL one.

xolox commented 11 years ago

Highlighting of tags based on tags files that grow beyond half a megabyte quickly gets awkward (as in really slow). Of course this kind of depends on the speed of your CPU and disk, but tags files beyond a megabyte are definitely not handled very well by Vim + easytags.

I don't know Vim's syntax highlighting engine well enough to tell if there is something significant that can be done about this or if I just have to accept this as a limitation of Vim... If you have any suggestions I'm certainly open to new ideas. The current status is that I know about the limitation and was kind of disappointed when I first found out, but I honestly don't know how to improve the situation (beyond minor optimizations that won't matter in the grand scheme of things).

xolox commented 11 years ago

One more thing which may or may not be related: I've noticed that syntax based folding and dynamic highlighting don't work together very well; the combination causes a lot of lag in Vim's rendering. Unfortunately I haven't found a proper explanation for this. Are you using syntax based folding?

reportados123 commented 11 years ago

What's syntax based folding? I don't think I am, all I really have is molokai as my theme, installed some syntax files for C/C++, YouCompleteMe, and vim-easytags.

That sucks though, I think it is a limitation of vim though, my CPU is an i7-2700k, which is quad core 3.5GHz. Shouldn't be a problem, with 16 GB of RAM DDR3. I have a standard 1 TB HDD which is 7200 RPM.

axujen commented 10 years ago

Hello, i have been looking for a solution for this problem when i came accross this vim plugin that does exactly this without the lag. Right now i am using it in conjuction with easytags but it would be great to see this implemented in easytags itself.