Closed idbrii closed 11 years ago
I switched rails.vim to autoload several years ago, and I still get the occasional bug report that boils down to an installation issue. So hopefully you can understand my reticence to switch any other plugins over, without at least understanding the problem.
I swear last night speeddating.vim was one of my slowest plugins as well, but this morning it's in the middle of the pack. So I will let you be my eyes on this one. I suspect the slow part is parsing the built-in formats. If you remove them (delete the lines calling SpeedDatingFormat
), does the load time drop significantly? If so, we can probably just defer parsing, which would solve the problem in a way that also allows custom formats to benefit.
+1; here's my tally of the slowest scripts (on Cygwin; that's where I have a Vim with profiling support compiled in).
Total Self Script
0.036000 0.007000 /cygdrive/d/A/.vimrc
0.027000 0.002000 /cygdrive/d/A/.vim/plugin/speeddating.vim
0.027000 0.000000 /cygdrive/d/A/.vim/plugin/fuf.vim
The use of :SpeedDatingFormat
doesn't seem to matter for me; numbers are the same when I comment those out.
Don't be afraid of autoload; I package my many plugins as Vimballs, and never had an installation issue.
Vimballs are a terrible argument for anything. But I'm sold after noticing speeddating.vim is actually the second largest file in my .vim/plugin
.
I do, however, want to figure out how to prevent custom :SpeeddatingFormat
s from triggering autoloading. If I'm going to be responsible for maintaining an autoloader, I damn well want to reap the benefits myself. :)
I've converted speeddating into an autoload plugin. It was one of my longest times from
gvim --startuptime
. Now it's down below one millisecond from ~25 ms.The downside is that using SpeedDatingFormat will trigger the plugin to be loaded, so users defining their own formats won't see any benefit -- speeddating will be loaded on startup for them. This could probably be solved by having the user define a function that's autoloaded and called from the plugin (although you'd have to squelch the unknown function error when the user doesn't define their own format). Maybe you have a better idea?