views:

325

answers:

2

I'm running Ubuntu 8.04 and I ran the command:

$ ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -f ~/.vim/tags/stdlibcpp /usr/include/c++/4.2.4/

to generate a ctags database for the standard C++ library and STL ( libstdc++ ) on my system for use with the OmniCppComplete vim script. This gave me a very reasonable 4MB tags file which seems to work fairly well.

However, when I ran the same command against the installed Boost headers:

$ ctags -R --c++-kinds=+p --fields=+iaS --extra=+q -f ~/.vim/tags/boost /usr/include/boost/

I ended up with a 1.4 GB tags file! I haven't tried it yet, but that seems likes it's going to be too large to be useful. Is there a way to get a slimmer, more usable tags file for my installed Boost headers?

Edit

Just as a note, libstdc++ includes TR1, which has allot of Boost libs in it. So there must be something weird going on for libstdc++ to come out with a 4 MB tags file and Boost to end up with a 1.4 GB tags file.

Just ran across this on the Boost mailing list:

Boost-users Boost and autocompletion

+2  A: 

use the option

--sort=foldcase

With this the searching of the tags becomes faster.

Quoting from the man page of ctags : "The foldcase value specifies case insensitive (or case-folded) sorting. Fast binary searches of tag files sorted with case-folding will require special support from tools using tag files, such as that found in the ctags readtags library, or Vim version 6.2 or higher (using "set ignorecase"). This option must appear before the first file name"

Vicky
Will this reduce the size of the tags file to reasonable dimensions? I mean, stdlibc++ includes the STL and TR1 which actually has allot of Boost in it - and it's only 4MB!
Robert S. Barnes
I am not sure about the size, but my tag search speed in VIM was increased atleast 5 fold..
Vicky
No. Including the sort option gives me no gain in Ubuntu 10.04. Still getting the 1.4G file size
ancechu
+2  A: 

I know this post is a little old, but I just ran into the same problem. I looked into it a little further and it seems it is one folder in boost that is causing the problem: typeof. I am using boost 1.37 and my tags file was 1.5G, typeof was 1.4G of that. So I just created a tags file without that directory included and the resulting size was 70M. I was even able to sort it without running out of space :) I imagine in newer versions of boost they may be other projects that are too large however the general solution I found is this...

  1. Generate a tag file for each boost folder seperately, a simple bash for loop should be able to do this.
  2. Look at which ones are too large.
  3. Either create a new single tags file excluding those large directories or keep the tag files separated simply deleting the ones that are too large.

Hope this helps...

Neg_EV
I don't suppose you could post the script?
Robert S. Barnes
This should generate separate tag files to find the culprit:for i in $(find -maxdepth 1 -type d | grep -v '^\.$' | sed 's/\.\///' ); do echo $i; ctags -f ~/tmp_tags/$i.tags -R --c++-kinds=+p --fields=+iaS --extra=+q --languages=c++ --sort=foldcase $i; doneThen to generate a single tags file you can simply do something similar to:ctags -f ~/tmp_tags/all.tags -R --c++-kinds=+p --fields=+iaS --extra=+q --languages=c++ --sort=foldcase $(ls -d * | grep -v typeof );The grep -v part is where I exclude things such as typeof. Both commands assume you are in the boost include dir.
Neg_EV