neovim/neovim — pull request #1241 by splinterofchaos (2014-09-25 16:48:26+00:00)
Title: Run :make, :grep, etc. asynchronously as a Job.

Not sure if this is the right way to do it, or even if it's a good thing to do, but these changes significantly improve the performance of the `:make` and `:grep` families by running them as `Job`s instead of redirecting to an outfile then reading from it. I used this tiny vim script to test the performance:
```vim
function! s:grep_job()
grep color **.c
endf

command DoIt call s:grep_job()
```
and ran it with `$ build/bin/nvim -S grep.vim --cmd 'profile start grep.profile' --cmd 'profile! file grep.vim' -c 'DoIt'`

The profiled time for the line `grep color **.c`:
```
count total (s) self (s)
1 0.413358 0.162599 grep color **.c
```
and with this PR:
```
count total (s) self (s)
1 0.179551 0.114989 grep color **.c
```
Less than half the run time! Although I have found the gains vary with the size of the output, it's never slower.

TODO:
[ ] Fix test failures.
[ ] Check for bugs
[ ] Preserve the order of output(?)
[ ] `qf_init_ext()` compiles several regex programs every time it's run. We can improve performance by saving the program and using it on the next run, but proving that skipping that massive code block is safe may be tricky.
[ ] Update obsolete documentation in `runtime/`.