[pypy-dev] a possible leak in the object namespace...

Carl Friedrich Bolz cfbolz at gmx.de
Tue Nov 30 18:33:45 CET 2010

Hi Alex,

On 11/29/2010 09:02 PM, Alex A. Naanou wrote:
> On Mon, Nov 29, 2010 at 21:46, Carl Friedrich Bolz<cfbolz at gmx.de>  wrote:
>>   a) lots of attributes, which we expect to be rare
>>   b) access them with setattr, which is a lot slower than a fixed attribute
>>   c) access a different attribute every loop iteration, which means the
>> compiler has to produce one bit of code for every attribute
> This is intentional (all three points), I did not want the jit to
> factor out the loop -- I wanted to time the initial attribute
> creation...

Yes, I fear initial attribute creation is never going to be very efficient.

> But quadratic behaviour + a three orders of magnitude increase in time
> it takes to create an attr is scarry... but you are right, how often
> does that usecase happen? :)

I improved some things so that setattr/getattr is a bit faster. Should 
now only be one or two orders of magnitude :-). If you run it tomorrow 
with the nightly build from tonight, you should see an improvement.
The quadraticness is not easily fixable without giving up all 
optimizations with instances of more than X (maybe 1000?) attributes. 
Again, I don't think this is common. And I don't want to chose an X.


Carl Friedrich

More information about the Pypy-dev mailing list