emacs-helm/helm-ls-git — pull request #22 by itiut (2014-10-02 19:51:59+00:00)
Title: Improve on how to get a branch name

Improve on how to get a branch name by reducing the frequency of executing shell commands.

I feel it's slow to execute a shell command **always twice** in order to get a branch name, and it's actually slow as far as I profiled.
So I reduce the frequency of executing shell commands referring to [oh-my-zsh's git plugin](//github.com/robbyrussell/oh-my-zsh/blob/master/lib/git.zsh#L4-L5).

### Profiling steps
1. Open a file in a clean git repository.
* M-x elp-instrument-package RET helm-ls-git RET
* M-x elp-instrument-function RET shell-command-to-string RET
* M-x helm-ls-git-ls
* C-g after `helm-ls-git-ls` results are displayed.
* M-x elp-results

### Profiling results
#### before
```
helm-ls-git-ls 1 1.720472 1.720472
helm-ls-git-header-name 1 1.3683969999 1.3683969999
shell-command-to-string 2 1.367515 0.6837575
helm-ls-git-status 1 0.008327 0.008327
helm-ls-git-init 1 0.007876 0.007876
helm-ls-git-list-files 1 0.007291 0.007291
helm-ls-git-root-dir 3 0.000319 0.0001063333
helm-ls-git-transformer 1 0.000119 0.000119
helm-ls-git-status-transformer 1 6.4e-05 6.4e-05
helm-ls-git-sort-fn 1 1.8e-05 1.8e-05
```

#### after
```
helm-ls-git-ls 1 1.049938 1.049938
helm-ls-git-header-name 1 0.673281 0.673281
call-process-shell-command 1 0.673149 0.673149
helm-ls-git-status 1 0.008407 0.008407
helm-ls-git-init 1 0.006931 0.006931
helm-ls-git-list-files 1 0.006734 0.006734
helm-ls-git-root-dir 3 0.00026 8.666...e-05
helm-ls-git-transformer 1 0.000124 0.000124
helm-ls-git-status-transformer 1 6.4e-05 6.4e-05
helm-ls-git-sort-fn 1 2.1e-05 2.1e-05
```