Speed up alpha sorting: from 0.070 to 0.027.
Do not filter before going through all the chunks of a result.

This save some ms: from 0.147s to 0.137s
Calling python print in a thread can segv vim.
Improve filtering: from 0.027s to 0.021s
Use get() to retrieve the translation unit.

While I cannot show any performance improvement, I'll argue that the
complexity of retrieving a translation unit is now two times faster.

The python "in" keyword has to walk to the datastructure once, and we
walk a second time to retrieve it. We only walk it once now.
Merge branch 'perf'

Conflicts:
	plugin/libclang.py
Merge: Fix a copypasto bug. Also rename the parameter in question to not
shadow the 'file' builtin, and fix up a docstring a little.

Hat tip to Sebastian Kreft Carreno at Google for noticing the bug.

https://llvm.org/svn/llvm-project/cfe/trunk@169887
Merge: [python bindings] Expose cursor.referenced (clang_getCursorReferenced).

Patch by Matthew King!

https://llvm.org/svn/llvm-project/cfe/trunk@171423
Merge: [cindex.py]: Speed up lookup of the completion kind

We can directly the number of the kind instead of going through the
completionChunkKindMap.

Formatting time changes from 0.84 to 0.72 seconds.

https://llvm.org/svn/llvm-project/cfe/trunk@17289
Merge: [cindex.py] Replace CachedProperty with our own implementation

This is a very performance critical point for auto completion. The
manual implementation gives a large speedup. As it does not complicate
the code a lot, I figured it is worth the change. If anybody understands
why the CachedProperty is here so much slower, I am very interested in
working on an improvement of CachedProperty.

Formatting time changes from 0.72 to 0.57 seconds.

https://llvm.org/svn/llvm-project/cfe/trunk@172900
Merge: [cindex.py] Add cache for CompletionChunk spellings

Most of the CompletionChunks represent braces, colons or other one
character spellings. There is no need to call libclang, to figure out
how to write a colon. Instead we use an internal cache to retrieve the
correct spelling. As function calls from python are very expensive and
this is a performance critical part of auto completion this patch makes
formatting of auto completion results a lot faster.

Formatting time changes from 0.57 to 0.45 seconds

https://llvm.org/svn/llvm-project/cfe/trunk@172901
Merge: [cindex.py]: Use spaces instead of tabs

The tabs slipped in accidentally.

https://llvm.org/svn/llvm-project/cfe/trunk@172934
Remember the last compilationDatabase query, and return it when the file is not found

This is a very common case : it happens for all headers. In practice, this heuristics gives good results.