[pypy-dev] set with instances very slow from 1.8 to 1.9

Lukas Diekmann Lukas.Diekmann at uni-duesseldorf.de
Tue Jun 19 18:33:07 CEST 2012


Hi,

you are right. Union between two sets of objects are slower, since we
introduced mechanics to make set operations with primitive types (e.g.
ints) faster.
The problem was that a fastpath was removed in that process. I readded
it. Union/Update with sets of objects should be fast again in the future.

Thank you for figuring that out. Your program was very helpful.

Commit: https://bitbucket.org/pypy/pypy/changeset/452bb2805140

Lukas

Am 19.06.2012 15:51, schrieb wilk:
> Hi,
>
> I could isolate a piece of my code that show a big regression from 1.8 
> to 1.9, event from cpython to 1.9 with operations on set of instances.  
> On the other side set of integer are faster !
>
> Should i open an issue on the bug tracker ?
>
>
> $ python t.py
> with instances = 0.02350
> with integers =  0.02825
>
> $ pypy-1.8 t.py
> with instances = 0.00935
> with integers =  0.02891
>
> $ pypy-1.9 t.py
> with instances = 0.41753
> with integers =  0.00628
>
> pypy-last/bin/pypy t.py
> with instances = 0.34686
> with integers =  0.00628
>
>
> import random
> import time
> import sys
>
> class X:
>     pass
>
> def bcl(a,b):
>     for i in range(1000):
>         a |= b
>
> x1 = set([X() for i in range(1000)])
> x2 = set([X() for i in range(1000)])
>
> start = time.time()
>
> bcl(x1, x2)
>
> print "with instances = %.05f" % (time.time()-start)
>
> x1 = set(range(1000))
> x2 = set(range(1000))
>
> start = time.time()
>
> bcl(x1, x2)
>
> print "with integers =  %.05f" % (time.time()-start)
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120619/c8d6b1f4/attachment.html>


More information about the pypy-dev mailing list