I was trying to get my tests as fast as possible like in gary bernhardts videos. I noticed even running the rspec command with no test at all took about 500 ms.
I know there is weird stuff in my .bashrc that takes awhile to load the first shell. But does that slow down every command as well?
🍒tony@moguya ~$ time ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
real 0m0.504s
user 0m0.041s
sys 0m0.042s
That seems slow. Here is what running time ruby -v looks like on a fresh vm:
vagrant@vagrant-ubuntu-trusty-64:~$ time ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
real 0m0.008s
user 0m0.006s
sys 0m0.006s
That’s about 63 times faster!
What could be causing the slowness? I had a few ideas: PS1 git prompt completion
I commented out my git completion and prompt, still slow.
🍒tony@moguya ~$ time ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
real 0m0.521s
user 0m0.044s
sys 0m0.051s
Next I switched to a normal ps1, that seemed to help a little bit.
moguya:~ tony$ time ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
real 0m0.094s
user 0m0.039s
sys 0m0.038s
Aha! Its definitely the PS1.
I added the git completion and git status back to my PS1, it doesn’t seem to cause that much slowdown. Changing colors alot seems to slow it down quite a bit. I also had an emoji in my PS1, not sure if that caused additional slowdown.
Still not quite as fast as the fresh VM.
What else could be slowing me down? Sheer number of programs installed? Complicated path? Large path?