Merge performance changes from cindex.py

This pull request syncs our cindex.py again with the upstream cindex.py version. The main reason for this sync are three performance related changes that I committed to the core clang repository. For examples/boost.cpp these changes improve completion time for me from 0.84 to 0.45 seconds.