[Cubicweb] lgc.cache in cubicweb

Aurélien Campéas aurelien.campeas at logilab.fr
Thu Sep 8 10:49:40 CEST 2011

Le 07/09/2011 15:13, Sylvain Thénault a écrit :
> On 07 September 14:21, Aurélien Campéas wrote:
>> While tracking potential optimisation topics in the cw code base, I
>> crossed logilab.common.cache usages in the querier and native
>> source.
>> Reading the lgc.cache code it occurred to me that it may not be
>> optimal (for the cw usage at least).
>> So I've written a replacement that tries to be less ruthlessly
>> inefficient and at the same time attempts to not leak memory.
> sounds cool
>> Here's the output of a small benchmark I just made up using
>> pre-recorded queries from one big unit test (one that generates a
>> lot of requests). The cache sizes are up-varying.
> I guess given results are benchmark of the code out-of-context.
> Do you have an idea of potential impact on overall cubicweb queries
> execution ?

The numbers I showed are built with a microbenchmark that only compares 
these objects and their operations.

I expect the impact to be slightly (un)perceptible in the real world 
with cubicweb.

However taken in aggregate improvements of this kind will inevitably 
lead to measurable gains.

Also in lgc.cache all operations are protected by a lock (to mimick the 
atomicity of a plain python dict I guess), which _maybe_ also hurts a 
bit concurrent access performance.

So in the end I can't give any hard answer to your question.

More information about the Cubicweb mailing list