If performing a particular action in Vim is slow, you can profile just a particular set of actions.
In this example, I created an obvious performance culprit. I downloaded the Python and Vim repositories from GitHub, and tried running the :CtrlP command that's provided by a CtrlP plugin (which we explored in Chapter 2, Advanced Editing and Navigation). :CtrlP will try to index all the files recursively starting at the current directory, which should be slow for such a large number of files.
Start Vim as usual, and execute the following set of commands:
:profile start profile.log:profile func *:profile file *
From now on, Vim will profile every action you'll perform. Run the slow command. In our case, let's run ...