New issue 3005: Instances from a class returned by a function getting slower and slower https://bitbucket.org/pypy/pypy/issues/3005/instances-from-a-class-returned-by-a
Simp fally: pypy3 v6.0.0 linux64 / python3 3.5.3 / debian 9.0 The code attached explains the problem in 15lines better than I could with word (see terrible title). On my laptop, here are the results : python3 test_ai.py : Using factory's class : 1 took 1.2839s 2 took 1.2842s 3 took 1.2922s 4 took 1.2745s 5 took 1.2786s 6 took 1.2802s 7 took 1.3013s 8 took 1.3907s 9 took 1.3533s Using simple class : 1 took 1.2037s 2 took 1.2108s 3 took 1.2229s 4 took 1.2286s 5 took 1.2041s 6 took 1.2028s 7 took 1.2059s 8 took 1.2153s 9 took 1.2038s Everything is normal here. pypy3 test_ai.py : Using factory's class : 1 took 0.0088s 2 took 0.0092s 3 took 0.0739s 4 took 0.0891s 5 took 0.1015s 6 took 0.1285s 7 took 0.1302s 8 took 0.1465s 9 took 0.1648s Using simple class : 1 took 0.0089s 2 took 0.0077s 3 took 0.0078s 4 took 0.0077s 5 took 0.0078s 6 took 0.0076s 7 took 0.0078s 8 took 0.0078s 9 took 0.0076s Here the factory class' instances are slower and slower (with no signs of stopping, even gets slower than python3 at some point), while the normal class behave perfectly normal. pypy3 -jit off test_ai.py : Using factory's class : 1 took 2.8622s 2 took 2.8545s 3 took 2.8629s 4 took 2.8517s 5 took 2.8687s 6 took 2.8776s 7 took 2.8641s 8 took 2.8607s 9 took 2.8625s Using simple class : 1 took 2.9355s 2 took 2.9193s 3 took 2.9442s 4 took 2.9261s 5 took 3.1136s 6 took 3.2729s 7 took 3.3295s 8 took 3.2764s 9 took 3.2918s Slower than python3 but at least it's stable. This bug has effected a larger project of mine and I managed to find the minimal code for it. It's easy to work around it but it means throwing away class factories. _______________________________________________ pypy-issue mailing list pypy-issue@python.org https://mail.python.org/mailman/listinfo/pypy-issue