[cfe-commits] [PATCH] cindex.py optimization
Tobias Grosser
tobias at grosser.es
Sat Aug 18 17:12:27 PDT 2012
On 08/18/2012 11:56 PM, Francisco Lopes da Silva wrote:
> Hi, this patch contains optimizations for the python cindex binding,
> specifically for the CompletionChunk class. It tries to avoid calls to
> the c interface by caching the results, also, it improves internal
> checking by avoiding string comparisons and dictionary lookups.
Hi Francisco,
it is very impressive to see how much the caching of properties actual
benefits clang_complete. Such a speedup is a very good reason to enable
caching of properties.
The way the caching is implemented is correct, however I expect that we
want to do more and more caching in the future. Hence, limiting the code
bloat for caching seems to be important. I remember Gregory Szorc had a
patch available that introduced a @CachedProperty that allows us to
cache properties by just adding an attribute:
https://github.com/indygreg/clang/commit/a4b533cea8cfce5d211d8e0477dd12fd66b35f5d
What about using this opportunity to add CachedProperty to the current
cindex.py and to use it to implement the caching that you propose for
the CompletionChunks.
Also, I did some experiments myself and I had the feeling a large part
of the speedup you show came from caching, whereas avoiding string
comparisons and dictionary lookups did not make such a big difference.
Hence, I propose to first add the caching to cindex.py and then
reevaluate the other changes on their own to see if the performance
change they cause is worth the added complexity.
Cheers
Tobi
More information about the cfe-commits
mailing list