I am finding that the new taglist() function performans much slower than
the :tag command for the same pattern. I have a couple of huge tag
files in 'tags' and doing something like:

:ta /.*t<Tab>

will start giving me the matches with in a second or two (at the most),
but calling taglist('t') will take a long time (didn't finish after
waiting for a couple of minutes). I would imagine both :tag command and
taglist() using the same tag lookup code, so probably it is the
generation of list of dictionary entries that is very inefficient. To
test this theory, in a crude way, I tried:

:echo len(taglist('z'))

And I got 5427 as the response in a couple of seconds, so the match for
't' must have been a lot more, resulting in a lot more time taken.

On a smaller tags file of containing only about 40,000 tags (about 4mb),
for pattern 't', I got a match of 34361 entries, but it took about
10seconds to complete, but if I use the :tag command the response is
almost instantaneous.

On further study, I realized that the :tag command with pattern comes
back with matches very fast, but the same with :ts is very slow, so
something like:

:ts /.*t<CR>

will take a long time to come up with the list. I don't know if this is
because Vim is trying to create a buffer containing all the entries for
presentation purposes, for the same reasons taglist() is also slow. In
any case, if creating such a huge list of dictionary items is going to
be so time consuming (and memory intensive), how about supporting a
second argument for passing an index? In this case, the script can
restrict it to always say, only the first 100 entries (or whatever is
configured by the user). I would assume that there are optimizations for
fast lookup of the same pattern (the way :ts command performs in
subsequent invocations), if you have to call the function 100 times.

-- 
Thanks,
Hari

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to