-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vim-bundler slows down vim startuptime significantly #38
Comments
I need a hell of a lot more to go on than "larger". |
The huginn project made me notice. |
On that project I get a bit less than half a second attributable to bundler.vim. Are you on modern hardware, fast storage (i.e. not an SD card or network share), and the latest version of bundler.vim? |
This is on a very beefy machine with SSD. |
If it's not CPU or disk bound then the obvious potential culprits are the two Ruby invocations that happen:
See how fast those are. Try using |
Interestingly I notice the lag not only when opening the Gemfile, but also on any other ruby file from that project. |
So that explains one second, but not several. (I get 0.1 seconds each for them, for the record.) Does the delay happen at start up only, or does it continue to happen upon opening additional files from the same project? |
It happens during startup and when opening other files. |
Bundler.vim aggressively caches, so if it happens repeatedly, the ultimate culprit is likely another plugin. Bundler.vim puts all your gems into |
Ok. Disabling all other plugins except |
Okay, so the next step is to add plugins back and figure out which is the trigger. |
I'll have to retract my last comment. Commenting out all other plugins, augroups and settings except |
Try |
I have faced this problem too. If can help, I've traced the output of
You can see around line 146 the time of sourcing For this test I was in this situation:
I was in the root directory, in |
That's on |
I've done a test commenting out the content of https://github.com/tpope/vim-bundler/blob/master/compiler/bundler.vim in my With the full file commented, the load time is still of a second (if I delete the file, I'll have an error here, if I comment out that line, the problem is still there). As additional info, I'm using pathogen, and
|
Regardless of the mechanics at play, that file itself isn't to blame. The profiler will give more useful information. |
I also noticed a slowdown with I noticed that this project used a version of ruby (2.1.0) that I no-longer had installed. I used rbenv/ruby-build to install it, and then startup time was acceptable again. Is it possible to better handle the scenario where the required ruby is not installed? |
Okay, that's quite a few clues. With the required Ruby not installed, Can you try the two Ruby commands listed above and report both their times and output? |
Sorry, I was away on vacation for the last week. I get a syntax error from the first command you pasted, so I modified it to: With the ruby missing:
With the ruby installed:
|
This one still appears to be an issue… Has anyone managed to get to the bottom of this? |
I did some tests for this with some settings, and the results can be seen here: https://gist.github.com/nikhgupta/86011b5ab70fb492ec52. Summarized here are the load times with a minimal vimrc (I did some tests after posting that gist, and hence, some of the following values are not seen in the above gist):
Overall, this all seems consistent to me, and considering that @tpope However, I would really really love to know a way to suppress these 2 system calls if possible to lower this down further. One of the commands can be suppressed by setting It seems that the other command is trying to get the ruby version for the current bundle. If so, can I make it read from |
How long does a single |
We already check |
@tpope A single Also, by checking the time for these commands, what I wanted to convey was that |
Yeah no doubt that even in the best case See #34 for more info about that Looking at the code also suggests that maybe |
I've experienced slow startup times with vim-bundler off and on for the past few years. I don't think I use anything that its giving me and in my pairing I haven't seen anyone else at thoughtbot use `:Bundle`, gem ctags or anything else that this plugin adds. See: tpope/vim-bundler#38
I've experienced slow startup times with vim-bundler off and on for the past few years. I don't think I use anything that its giving me and in my pairing I haven't seen anyone else at thoughtbot use `:Bundle`, gem ctags or anything else that this plugin adds. See: tpope/vim-bundler#38
Improve startup time. tpope/vim-bundler#38
You will also run into vim starting noticeably slowly when using vim-bundler in combination with jruby. The abi_version system call mentioned in an earlier comment will each take ~2 seconds, due to JVM startup time. Unfortunately I don't see a reliable alternative either. What helps a bit for the 'abi_version' call, is adding the In my setup the abi_version call is actually performed twice during startup and I'm not yet clear on why that is. Added a pull request for the change I'm locally using: #47 |
With |
For instance like |
Are there any exceptions to the rule that Ruby version 2.x.y has ABI version 2.x.0? It seems like it would be simple to map between the two. Maybe limit ourselves to 2.4 and earlier so we don't get screwed by future releases. I guess one additional concern is that |
Maybe we can do this Ruby detection in background using |
We need the resulting path synchronously for most uses, so the most that could do would be to allow it to happen in parallel with the rest of the detection. And it doesn't sound like that would help much. |
It feels worth calling out that 04d2980 combined the ABI version query and Gem path query into a single call. Multiple comments of mine above suggest possible ways to avoid the ABI version query, but they won't help with the Gem path query, so they're effectively useless now as far as I'm concerned. |
In larger ruby projects, vim-bundler increases vim startup time to several seconds.
After bisecting my
.vimrc
I found the vim-bundler plugin to be the culprit.Bundler version 1.6.2
The text was updated successfully, but these errors were encountered: