company-mode/company-mode — pull request #228 by trishume (2014-11-10 21:21:28+00:00)
Title: Improve Clang completion performance

On systems with `grep` installed this significantly improves performance in scenarios with little context by filtering the results by the prefix. It does this because clang only takes `0.3`s or so to create the completion but it takes a long time for Emacs to read that into a buffer, this just trims down the size before it enters the buffer and minimizes that hit.

This fixes #225 see that issue for discussion of problem and some timings.

On systems that don't have `grep` (like Windows :disappointed: ) it falls back on running clang directly.
Expected number of users hitting this code path is zero because it's very hard to install Clang on Windows and nobody does it, and who else doesn't have grep? I did test it though.

This change improves performance for global scope completion in a small project from around 20s (the async timeout means the results are ignored when they do arrive) down to a fraction of a second for a 2 character prefix. From a qualitative perspective it feels SOOO much faster all around.