[cfe-commits] [PATCH] cindex.py optimization

Tobias Grosser tobias at grosser.es
Sun Aug 19 15:30:18 PDT 2012


On 08/19/2012 11:21 PM, Gregory Szorc wrote:
> On 8/18/2012 5:12 PM, Tobias Grosser wrote:
>> 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.
>
> I've added the CachedProperty decorator to cindex.py in the repository.
> Although, I haven't hooked it up to anything yet. Please update your
> patch to use it.

I added the CachedProperty to CompletionChunk in 162191.

Tobi



More information about the cfe-commits mailing list