[pypy-dev] JIT slowdown on creating types

Vasily Evseenko svpcom at gmail.com
Mon Jun 3 12:08:57 CEST 2013


Hi,

When i dynamically create new type (for example classes nested to
functions) I've got linear code slowdown:

-----
def test():
    obj = type('foo' , (object,), {'attr1': 0})()

    for i in xrange(1000000):
        obj.attr1 += 1


for j in xrange(100):
    ts = time.time()
    test()
    print time.time() - ts
------
# pypy ./test.py
0.0529999732971
0.0519850254059
0.0545370578766
0.0622198581696
...
0.678023099899
0.686202049255
0.68180680275
0.703506946564

[PyPy 2.0.2 with GCC 4.4.5] on linux2

Is it bug or a feature?


More information about the pypy-dev mailing list