tags:

views:

88

answers:

2

My entire source code base is < 20MB. I want it all loaded in memory in the background. So that when I do vimgrep */.cpp */.cxx */.hpp , it doesn't ahve to do file IO since vim has loaded all the files into memory already.

How can I achieve this?

Thakns!

+1  A: 

copy your files to a ramfs partition (volatile) and do your thing there. and don't forget to copy the processed files back to a non-volatile partition

Joset
This just makes the IO fast, but it is still going through the kernel's file IO interface. That's better then reading off a spinning disk, but not as good as caching the results into the program that is going to use them. Moreover, there is a good chance that the kernel's caching mechanism can handle this better than you can, and without the need for you to remember to save back to persistent storage. RAM disk for speed are usually a hack to overcome a deficient OS caching mechanism.
dmckee
True as that is, ramdisks are about the fastest way you can pull something like this off for the widest number of use cases, getting 90% of the value for 10% of the effort.
Tomislav Nakic-Alfirevic
+1  A: 

If a file is already loaded into a buffer when you do :vimgrep then vim will search the buffer instead of the file on disk, so you could start vim with all the files on the command line:

$ vim *.cpp *.cxx *.hpp
... vim loads...
:vimgrep /stuff/ *.cpp *.hpp
Dave Kirby