If you have understood the last section, then using caching will be very easy. If you just skimmed over the last section, you should probably go back and read it properly to understand.
The first step is to go to the gmail preferences, goto 'misc' and click on the button to 'cache vfolders'.
Now caching is turned on. That means that gmail is no longer running your vfolder queries, but relying on the information in the 'matched index' (MI).
When new messages are downloaded their MI will be created automatically.
When you add, modify, or delete a vfolder you will have a problem because your MI information will be out of date. When this happens you have to do two things: (1) Recreate the Matched Index. (2) Rebuild the MI Values.
These are both in the Settings->Advanced menu. But you will also find that Gmail will cleverly offer to do both jobs for you when you add, modify or delete a mailbox. Aren't you lucky!