Optimizing your iteration speedJuly 10, 2016
One Quora answer that’s really stuck with me for the past few months is Edmond Lau’s answer to “What are the things required to become a hardcore programmer?” The entire answer is solid, but this is the part I will focus on:
4. Optimize your iteration speed.
Say it takes you 12 seconds to search and navigate from a function call to where it’s defined. And suppose you have to do similar navigations 60 times per day. That’s 12 minutes per day spent navigating files. If you learn enough keyboard shortcuts in your text editor to navigate to a file in 2 seconds instead of 12, then over the course of a day, you’d save 10 minutes. Every year, you’d save an entire 40-hour work week.
Find 3 more similar optimizations, and you’d save a month. Imagine what you could do with an extra month per year.
Or suppose that you’re fixing a bug that requires you to start the app and then navigate through five screens to set up the right conditions to trigger the bug. Could you spend 10 minutes to wire it up so that it goes to the buggy screen on startup? You’d be able to iterate significantly faster on that bug with a small initial investment.
Systematically ask yourself, “How can I iterate faster?” The payoffs will be enormous.
One of the payoffs, not explicitly mentioned, is that decreasing your iteration time will lower your chances of emptying your mental “cache” or “stack” of things to do, i.e., getting distracted, while you’re spending time on minor, unnecessary context switches.
I’m a student currently at my second software internship. As someone who’s been developing stuff for just a little under two years, I’m not the fastest, but I’ve still managed to accumulate a list of small, medium, and large techniques that speed up my development. I feel like adopting every technique possible (like learning how to use the Dvorak keyboard, for me) would be impractical, so these are the ones that keep me fast but sane. It also goes without saying that different tricks will work for different people, so I hope my tips are general enough for most budding developers.
(By the way, most of these work best if you work in a Unix environment. Most of my work these days is done on OS X and when I’m ssh’d into Linux boxes.)
Select all/copy/paste (well-known)
Quickly navigate and select text
Using keyboard shortcuts such as
[Cmd-Left/Right]+[Shift-Cmd-Right/Left] to highlight a line. Experiment with these!
Get to the beginning of a line in the shell
New tab/Close tab in most programs that have tabs
Issue the last command in
At first, I thought it was a funny alias my mentor made, as in, “sudo, darn it!”. But
!! (read: “bang-bang“) is a great thing to know!!
Launch Sublime Text from the command line
You can either add an alias to the Sublime app in your shell profile or add a symlink to it in one of the
/bin folders of your
More: Stack Overflow link
Take advantage of Spotlight (or Alfred)
It takes me less than a second to launch the most-used applications on my desktop. To do that, all I have to do is type
[Cmd-Space] anywhere and the first few letters, if not just the first letter, of the application.
Oh My Zsh is an easy-to-install framework for installing and managing
zsh, an alternative shell to
bash. The most useful feature for me is its fast autocompletion and ability to simply tab through autocompletion results. It also makes your shell look fancy :)
Use a good
.vimrc if you use Vim
I’m pretty lazy and use the one by “amix” out of the box. If I cared more to study Vimscript, I could roll my own and be an
3l33t h4x0r, but this will do.
More: The ultimate vimrc
Add stuff to your
alias workonproj="ssh -t email@example.com 'cd ~/project_directory; bash'"
It’s quite nice to open up the shell and type in a short alias to ssh into a server.
If I have GitHub two-factor auth enabled, I’m required to use a “personal access token” to authenticate pushes if I cloned by HTTPS instead of SSH. In that case, I can just
echo $GITPAT since it’s an environment variable in my private shell profile, and copy-paste it whenever I have to authenticate. However, I stopped doing this when I learned about triggers for my terminal…
More: Learning the Shell
Take advantage of iTerm2
For command line work, I use iTerm2 instead of Terminal. There are a lot of great things about it, and one of them is triggers. A trigger is a regex that iTerm2 listens for, followed by an action, like automatically entering text as if the user had typed it in themselves. I have a trigger set up so that when
\[sudo\] password for rainier.ababao appears, the password manager opens and I just press
[Enter] for iTerm2 to put in my password.
More: iTerm2 triggers
Improve your words per minute (WPM)
Learn to keep your fingers on the home row and touch-type! It will be slow at first, but you’ll see gains from 40 WPM to 100-120 WPM within a few months if you practice every day. That’s at least doubling one’s typing speed!
(Edit: This isn’t to suggest that efficient coding has much to do with how fast you can type, but rather that this reduces the repetitive task of looking for unnaturally-placed characters on the keyboard.)
Some fun: play.typeracer.com
Master a text editor
I started forcing myself to use Vim last year and have since gotten faster editing with it than with any other text editor. Vim comes installed with
vimtutor, a classic interactive tutorial for the editor.
The common thread in a lot of these micro-optimizations is keeping your fingers on the keyboard and away from the mouse.
What are your favorite optimizations? Feel free to DM or tweet @rainieratx with corrections and suggestions.