sstephenson/rbenv — pull request #254 by RubenVerborgh (2012-08-13 07:10:48+00:00)
Title: Sped up rbenv-init by finding shell commands inline

**Problem**
`rbenv init -` is rather slow, which is an issue since it is used in shell startup scripts.
One of the causes is that inside `rbenv-init`, another call to `rbenv` is made:

commands=(`rbenv commands --sh`)

This makes the `rbenv init` command carry the rbenv startup overhead _twice_:
once for `init` itself, and once for `commands`.

**Proposed solution**
I have created a function inside `rbenv-init` that finds shell commands,
after an [earlier solution that hard-coded the commands](https://github.com/sstephenson/rbenv/pull/253) was [proven insufficient](https://github.com/sstephenson/rbenv/pull/253#issuecomment-7682615).

**Result**
On my system, execution times improved from

real 0m0.069s
user 0m0.022s
sys 0m0.047s

to

real 0m0.042s
user 0m0.012s
sys 0m0.029s

which is a 40% decrease.