Sometimes it takes a really long time to save a file out. Saving the same file after various changes takes various amounts of time. It does not seem to be related to file size.

I've disabled any plugins that could possibly do something at save time (I think). It is probably one of my autocommand groups so I'll be disabling them one at a time next.

But this got me thinking. I know you can profile startup in a very detailed way. I was wondering if it was possible to do the same for save? Then I could see which plugin or autocommand group is taking the most time, make adjustments, and compare the actual times.

Is it possible to profile save times in a similar way to which we can profile startup times?

  • 4
    stackoverflow.com/a/12216578 that should do it – Christian Brabandt Dec 11 '19 at 17:17
  • 1
    @ChristianBrabandt That is fantastic. Though it doesn't tell me when each thing happened, in my case ctags_prune taking 2.58s is definitely the culprit. Time to make some changes as to when that gets run. Thanks. – embedded.kyle Dec 11 '19 at 18:17
  • @ChristianBrabandt I don't remember seeing an answer about :profile on our site (I just discovered this feature it rocks!), so since it allowed OP to find the offending function maybe it would be worth to make it an answer :) – statox Dec 13 '19 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.