yields/gh-resolve — pull request #10 by MatthewMueller (2014-07-02 13:54:49+00:00)
Title: improve performance a bit

- only paginate if we haven't found anything yet
- for `*`, get `tags` first, if nothing get `heads`. getting both tags and heads was incredibly slow for big projects like bootstrap.

Performance difference when resolving `twbs/bootstrap@*`:

```
before: 14290ms
after: 1309ms
```

All the other tests don't really show much performance difference, probably because they're relatively small in comparison.

```
before:

resolve()
✓ should resolve a semver version to gh ref (1535ms)
✓ should sort properly (1614ms)
✓ should resolve a branch to gh ref (1217ms)
✓ should resolve branches with `/` in them (1867ms)
✓ should default to the latest tag when the ref is `*` (2110ms)
✓ should use master when there are no tags and ref is `*` (1266ms)
✓ should provide better errors for invalid repos (1227ms)

after:

resolve()
resolve()
✓ should resolve a semver version to gh ref (1884ms)
✓ should sort properly (2992ms)
✓ should resolve a branch to gh ref (1549ms)
✓ should resolve branches with `/` in them (1528ms)
✓ should default to the latest tag when the ref is `*` (1944ms)
✓ should use master when there are no tags and ref is `*` (3517ms)
✓ should provide better errors for invalid repos (1021ms)
✓ should resolve twbs/bootstrap@* quickly (1316ms)

```

Note when references `*` for small repos that have no tags, just master, there will be a decrease in performance.