Nothing Undone

A weblog, by Peter Jaros.

Benchmarking My Dotfiles.

I’m a huge fan of Gary Bernhardt’s Destroy All Software. If you’re not a subscriber, I highly recommend it. It’s $9 per month. Pay the $9, watch as many videos as you can in a month, and see if it’s not worth staying subscribed.

The things Gary teaches explicitly are wonderful, but there’s a lot to be learned implicitly from watching his screencasts. His patterns of working with Vim and editing files are often quite different from mine. For instance, Gary often opens Vim to edit a single file, closes it to get back to the shell, and reopens it to edit another file. I rarely do that. I keep Vim alive as long as possible, like an IDE. Why is that?

Because my Vim takes ages to boot up.

That’s hyperbolic of course; it takes seconds to boot. But seconds is a long time to wait every time you open a new file.

My problem’s even worse with opening shells. Since switching to Zsh and Oh My Zsh, my shell startup times have grown to more than 10 seconds, which really is a long time to wait with your next command in your head.

I’ve been ignoring both of these problems, even coming up with roundabout solutions like Ctrl-Zsh, which—while awesome, I maintain—has been saving me from some of the pain of starting new shells and vims.

The problem is that I have lots of plugins installed in both, and that’s a lot of load time. The thing is, I like those plugins. This post won’t tell you how to solve this problem, but it will give you the first step. Before you can fix something, you have to measure it. So I’m benchmarking my dotfiles.

Here’s the script:

First we purge the disk cache to get a worst-case scenario. Then we time booting up an interactive login shell, followed by a vim process.

My results? (I am not proud of this.)

1
2
3
Purging the disk cache...
zsh:  10.79s
vim:  3.28s

This post, I hope, will have a sequel.

Comments