On Do, 02 Apr 2020, Pratyush Yadav wrote:

> On 02/04/20 09:09AM, Christian Brabandt wrote:
> Strange. I did keep the list in Cc (v...@vim.org, but now I've also 
> included vim_use@googlegroups.com). I think my emails are being held up 
> by something because I noticed that when I sent the first email it took 
> a while (multiple hours) to show up in the Google groups archive. And 
> now I see that my reply doesn't show up in the archive even though my 
> mail client shows v...@vim.org in Cc.

Tony answered that already. I am one of those watching the pending 
moderation list, but I did not see your message there.

BTW: v...@vim.org is just an alias for vim_use@googlegroups.com so if you 
add both, we might receive the mail twice. Not that it matters much for 
me.

> > On Mi, 01 Apr 2020, Tony Mechelynck wrote:
> > 
> > > > Yes, the tags file is sorted and vim is built with +tag_binary and
> > > > 'tagbsearch' is on. The tags file wasn't case-folded sorted, but I tried
> > > > with that too and I see similar performance.
> > > >
> > > > Anyway, just to remove any potential confusion, jumping to tags via
> > > > 'CTRL-]' is blazing fast. So is listing all alternatives with 'g]'. Does
> > > > ccomplete use the same mechanism for searching tags file as those two?
> > > > If so, then I wonder why it is so much slower.
> > 
> > Hm, I had a quick look at ccomplete.vim. It not only does a tag search, 
> > but also searches the current file and more importantly, it might call 
> > :vimgrep and :vimgrep is known to be slow if many files have to be 
> > searched. Not sure if there is anything to improve, perhaps adding a 
> > switch to only do tag completion would already help?
> > 
> > Anyhow, first please create a vimscript profile, so we can exactly see 
> > when it is slow. See :h :profile and this stackoverflow answer: 
> > https://stackoverflow.com/a/12216578/789222
> > 
> > Perhaps this can share some more light on the slowness.
>  
> The profile log is pretty big (~3500 lines) since I use multiple 
> plugins. Trace of ccomplete#Complete and StructMembers() is pasted 
> below. Let me know if you need any more info, like traces of other 
> functions in the call chain.
> 
> The major time consumer looks like:
> 
>    21            130.867568       exe 'silent! keepj noautocmd ' . n . 
> 'vimgrep /\t' . typename . '\(\t\|$\)/j ' . fnames

indeed, that is slow. I have no idea how to make this faster. This uses 
Vims internal grep command and searches the tagfiles (fnames is the 
result of the tagfiles() function earlier) for the typename. That sounds 
wrong, because Vim has to load the file into a buffer, and do a regular 
expression search for the pattern then.

I wonder if one could change this to a taglist() function call and add 
the list to the quickfix list afterwards. I think this should be 
possible, but I am don't know the tagsearch interface very well. I CC 
Bram since he is the maintainer of that file and perhaps he can comment 
:)

Another alternative to think of is, if you have installed ripgrep or ag 
or another fast grep alternative, make use of that and do not use the 
slower vimgrep alternative. So if you have:

`:set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case` (I did a quick 
google search for ripgrep and on how to make this work with Vim, so take 
those arguments with a grain of salt)

and then replace that line:

exe 'silent! keepj noautocmd ' . n . 'vimgrep /\t' . typename . '\(\t\|$\)/j ' 
. fnames

with something like this:

exe 'silent! keepj noautocmd grep \b(?:'. typename . ')\b ' . fnames

would help? But that is just purely guessed.


Best,
Christian
-- 
Der Mensch ist erst wirklich tot, wenn niemand mehr an ihn denkt.
                -- Bertold Brecht

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/20200402100057.GG16659%40256bit.org.

Reply via email to