Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

very slow for big project #68

Open
lookforit opened this issue Sep 27, 2013 · 20 comments
Open

very slow for big project #68

lookforit opened this issue Sep 27, 2013 · 20 comments

Comments

@lookforit
Copy link

Hi
Be sorry to refer to this old topic again, but I can't find the answer in the posted issues.
When open a relative big(such as vim source code) project ,easytags makes cursor poor response,except I disable it manually.
I noticed that the tag files of the project is about 3Mb, so I wonder how to open a much larger project(eg Linux kernel) with easytags enabled.
Thanks.

@juliantaylor
Copy link

are you using vim 7.4?
the 7.4 regex engine is very bad for how easytags uses it.
see https://groups.google.com/forum/#!topic/vim_dev/cPcMap1BdQw

as suggested replacing syntax match with syntax keyword solves the issue for me.

@gpakosz
Copy link

gpakosz commented Nov 14, 2013

@juliantaylor could you please submit a pull request so that I can test this on my side?

@juliantaylor
Copy link

I applied this patch which works for me, not it drops suffix, don't know what its used for:

--- a/misc/easytags/highlight.py
+++ b/misc/easytags/highlight.py
@@ -51,5 +51,5 @@ def easytags_gensyncmd(tagsfiles, filetype, tagkinds, syntaxgroup, prefix, suffi
     return ' | '.join(commands)

 def _easytags_makecmd(syntaxgroup, prefix, suffix, patterns, ignoresyntax):
-    template = r'syntax match %s /%s\%%(%s\)%s/ containedin=ALLBUT,%s'
-    return template % (syntaxgroup, prefix, r'\|'.join(patterns), suffix, ignoresyntax)
+    template = r'syntax keyword %s %s containedin=ALLBUT,%s'
+    return template % (syntaxgroup, r' '.join(patterns), ignoresyntax)

you can also switch back to the old regex engine with:

set regexpengine=1

@aktau
Copy link

aktau commented Feb 27, 2014

The patch seems to work nicely on vim 7.4, the speed was crippling before this but now it's fine.

@aktau
Copy link

aktau commented Feb 27, 2014

I have to add though: after adding the patch, nothing is highlighted anymore. So the patch has the effect of disabling the highlighter somehow. Yet it's better than not being able to move my cursor around...

@juliantaylor
Copy link

hm the highlighter is still working for me with the patch, what kind of files are you looking at?

@aktau
Copy link

aktau commented Feb 27, 2014

Just plain C files :)

On Thu, Feb 27, 2014 at 6:30 PM, Julian Taylor notifications@github.comwrote:

hm the highlighter is still working for me with the patch, what kind of
files are you looking at?

Reply to this email directly or view it on GitHubhttps://github.com//issues/68#issuecomment-36267814
.

@aktau
Copy link

aktau commented Feb 28, 2014

@lookforit @juliantaylor my bad, it was a crazy wildignore issue on my part. Everything works perfectly now, thanks for the patch!

@q6r
Copy link

q6r commented Mar 2, 2014

Patch works perfectly with 7.4.135 thanks @juliantaylor

@aktau
Copy link

aktau commented Mar 2, 2014

Patch works perfectly with 7.4.135 thanks @juliantaylor

Yes, @xolox perhaps you could merge this with a version check for 7.4? That would be awesome and I wouldn't have to manually patch half of my vim installations :)

@mikedfunk
Copy link

Was this patched into master?

@aktau
Copy link

aktau commented Apr 29, 2014

@mikedfunk it was not, unfortunately. @xolox could you merge this please? If not, what still needs to be done?

xolox added a commit that referenced this issue Jul 8, 2014
This is part 1/2 of speeding up the vim-easytags plug-in. Refer to the
pull request for details: #84
In part 2/2 I want to speed up the dynamic syntax highlighting.
Potentially related open issues on GitHub (probably missed a few):

 - #32
 - #41
 - #68
xolox added a commit that referenced this issue Jul 8, 2014
See the following issues on GitHub:
 - #68
 - #80

Please note that right now this 'feature' is not integrated with
the "accelerated Python syntax highlighting" feature, because I'm
considering ripping that out and replacing it with a *fast* Vim
script implementation (if I can build one :-).
@xolox
Copy link
Owner

xolox commented Jul 8, 2014

Please try out version 3.6 (see b6f8757) and let me know how it works for you. By default it may still be slow, but take a look at the new g:easytags_syntax_keyword option. Note that 3.6 includes 3.5 which merged a huge feature branch, so here's hoping that works out well...

Please note that right now this 'feature' is not integrated with the "accelerated Python syntax highlighting" feature, because I'm considering ripping that out and replacing it with a fast Vim script implementation (if I can build one :-).

xolox added a commit that referenced this issue Jul 9, 2014
This is a bug fix / improvement to the new syntax keyword usage
introduced in b6f8757.

Also relevant is issue #68 on GitHub, see
#68
xolox added a commit that referenced this issue Jul 9, 2014
This is a bug fix / improvement to the new syntax keyword usage
introduced in b6f8757.

Also relevant is issue #68 on GitHub, see
#68
xolox added a commit that referenced this issue Jul 9, 2014
This is a bug fix / improvement to the new syntax keyword usage
introduced in b6f8757.

Also relevant is issue #68 on GitHub, see
#68

@tarmack: Thanks for the feedback earlier today, it's now fixed! :-)
@xolox
Copy link
Owner

xolox commented Jul 9, 2014

Ran into some minor issues with the new syntax keyword feature, all of them fixed now (see the commits referenced above this message in the GitHub issue).

ajswis added a commit to ajswis/dotfiles that referenced this issue Jul 29, 2014
@shtrom
Copy link

shtrom commented Nov 19, 2014

I'm running 3.9 (075ffe9) on Vim 7.4.473.

@aktau commented on 28 Feb

The patch seems to work nicely on vim 7.4, the speed was crippling before this but now it's fine.

@aktau commented on 28 Feb

I have to add though: after adding the patch, nothing is highlighted anymore.

I just manually patched this. It does successfully

  1. stop the slowdown,
  2. retain the highlighting.

@xolox commented on 9 Jul

Please try out version 3.6 (see b6f8757) and let me know how it works for you. By default it may still be slow, but take a look at the new g:easytags_syntax_keyword option.

letting g:easytags_python_enabled="always" in a buffer already editting a C file doesn't seem to fix the issue. Re-opening the file with :e doesn't either.

letting g:easytags_python_enabled=0 doesn't seem to work either (scrolling still slow afterwards).

@xolox
Copy link
Owner

xolox commented Nov 19, 2014

@shtrom: Please change the setting in your vimrc, restart Vim and see if it helps at all then. If that does indeed help then maybe old highlighting patterns (which are cleared by vim-easytags, just for the record) somehow remain in memory, throwing Vim off?

@shtrom
Copy link

shtrom commented Nov 20, 2014

Having restored vim-easytags to 075ffe9, I first tried to set let g:easytags_python_enabled="always", then let g:easytags_python_enabled=0, to no avail. I then created a vimrc from scratch with the minimum to run easytags, and did not notice any slow down. So I started disabling my other plugins.

The problem seems to come from amdt/vim-niji, and is there even when easytags is disabled.

I should have tried that earlier... Sorry for the noise.

@xolox
Copy link
Owner

xolox commented Nov 22, 2014

@shtrom: Thanks for the follow up, it's not always easy or obvious to find out what slows Vim down, I know all about this ;-).

@FinalFortune
Copy link

I just installed easytags, and I am experiencing massive delay. I applied the patch specified earlier in this post to my easytags, but there is no change. I am running vim 7.4. To verify that it is easy tags, here is the result from vim's profiling operation:

list of all functions ran

FUNCTIONS SORTED ON SELF TIME
count   total (s)   self (s)  function
3       36.393659   36.391486 <SNR>99_highlight_with_python()
1       36.416279   0.022375  xolox#easytags#highlight()
43      0.020129    0.014926  <SNR>132_ParseTagline()
2                   0.005630  signature#mark#GetList()
7       0.004975    0.004963  <SNR>132_SortTags()
1       0.043953    0.004553  <SNR>132_ProcessFile()
170                 0.004173  <SNR>132_CompareByKind()
52                  0.003358  signature#sign#Remove()
5       0.003738    0.002010  neobundle#autoload#function()
45                  0.001900  128()
43      0.002157    0.001887  134()
7       0.001889    0.001780  <SNR>132_AddScopedTags()
8       0.001861    0.001770  <SNR>132_GetNearbyTag()
1       0.006560    0.001769  98()
5                   0.001637  neobundle#config#get_autoload_bundles()
2       0.002769    0.001474  xolox#misc#os#can_use_dll()
3                   0.001389  <SNR>99_python_available()
1       0.041292    0.001320  xolox#easytags#update()
1       0.002832    0.001258  <SNR>99_check_cfile()
10      0.002840    0.001253  xolox#misc#path#absolute()

The highlight function

FUNCTION  <SNR>99_highlight_with_python()
Called 3 times
Total time:  36.393659
Self time:  36.391486

count  total (s)   self (s)
    3   0.001514   0.000046   if xolox#misc#option#get('easytags_python_enabled', 1) && s:python_available()
                                " Gather arguments for Python function.
    3              0.000010     let context = {}
    3              0.000359     let context['tagsfiles'] = tagfiles()
    3              0.000016     let context['syntaxgroup'] = a:syntax_group
                                " TODO This doesn't support file type groups!
    3   0.000378   0.000049     let context['filetype'] = xolox#easytags#filetypes#to_ctags(xolox#easytags#filetypes#canonicalize(&filetype))
    3              0.000016     let context['tagkinds'] = get(a:tagkind, 'tagkinds', '')
    3              0.000015     let context['prefix'] = get(a:tagkind, 'pattern_prefix', '')
    3              0.000015     let context['suffix'] = get(a:tagkind, 'pattern_suffix', '')
    3              0.000013     let context['filters'] = get(a:tagkind, 'python_filter', {})
    3   0.000413   0.000037     let context['ignoresyntax'] = xolox#easytags#syntax_groups_to_ignore()
                                " Call the Python function and intercept the output.
    3              0.000005     try
    3              0.000012       redir => commands
    3              0.000149       python import vim
    3             36.389045       silent python print easytags_gensyncmd(**vim.eval('context'))
    3              0.000042       redir END
    3              0.001601       execute commands
    3              0.000010       return 1
                                catch
                                redir END
                                " If the Python script raised an error, don't run it again.
                                let g:easytags_python_enabled = 0
                                endtry
                            endif
                            return 0

@kjyv
Copy link

kjyv commented Sep 2, 2016

Is this ticket still being worked on? I've been setting the regexpengine to 1 or 2 and can see a small difference (1 still being faster despite recent vim 7.4.2198). The real difference to make vim workable again other than emptying the .vimtags file is to manually switch to keyword matching as per the patch above. Shouldn't this be merged? The mentioned option g:easytags_syntax_keyword does not seem to do it (i.e. it is still slow after setting it to always).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants