[pypy-issue] [issue927] Task takes more time on nightly than CPython 2.7

Justin Peel tracker at bugs.pypy.org
Tue Nov 22 05:48:11 CET 2011

Justin Peel <peelpy at gmail.com> added the comment:

I think that a small card ref size for sets/dicts would help (I'll just talk 
about dicts from now on, but it applies to sets). However, I also discovered 
something that may be really slowing this down. Currently, whenever anything is 
put into a dict, the object is considered to be young without checking whether 
it is. There is code to do the checking, but there is a note saying that it was 
slower which is why it isn't used. Please correct me if I am wrong here.

Considering all inserted objects as young is fine for the example in this issue 
until the dict needs to be resized. When a dict is resized, every item from the 
old array is inserted into the new, larger array and considered to be young for 
the purpose of card marking. Since the card ref size is currently 128 and there 
should the array will have 1/3 of its items filled after resizing, all of the 
card refs will be set when a resizing is done.

I think actually checking if items are young when reinserting during the 
resizing process combined with a smaller card ref size could help a lot here.

By the way, lists are fine on the resizing front from what I see because direct 
memory copies are done for everything including the card refs. The difference 
with dicts is that the items are inserted pseudo-randomly so card refs can't be 

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list