Skip to content

hub 1.11.1 - ridododiculous speeds

Compare
Choose a tag to compare
@mislav mislav released this 26 Dec 00:55
· 2622 commits to master since this release

This new release of hub doesn't bring any bug fixes, only performance fixes. Version 1.11.0 made hub much faster compared to previous versions; this release makes it even faster.

This benchmark on Ruby 2.0.0-p247 demonstrates a 63 ms speedup for the hub browse command:

mean (s) stdev (s)
hub browse -u v1.11.0 0.134 0.007
v1.11.1 0.071 0.004

The speed gains were available in several areas:

  • When shelling out to git, hub used to silence stderr like so: cmd 2>/dev/null. Turns out, the mere presence of shell redirection syntax added a few milliseconds per call. Now there is no shell redirection, and hub simply silences STDERR from Ruby.
  • Reduce the number of shelling out to git across the board. Each git invocation takes 5–7 ms, and since we did that a lot, it added a lot of overhead at runtime. When possible, some shelling out was replaced by simply inspecting the files under the .git/ directory. In other cases, duplicate and similar calls were consolidated, and necessary calls are now done lazily, only when absolutely needed.
  • Reduced features in SshConfig, which is an ssh_config(5) parser that we use for resolving ssh aliases to full hostnames. SshConfig did too much and used to implement features that we never took advantage of, so I reduced it to a bare minimum which greatly increased parsing speed.