[pypy-dev] array performace?

Hakan Ardo hakan at debian.org
Thu Jul 1 16:02:30 CEST 2010


Hi,
are there any python construct that the jit will be able to compile
into c-type array accesses? Consider the following test:

    l=0.0
    for i in xrange(640,640*480):
        l+=img[i]
        intimg[i]=intimg[i-640]+l

With the 1.3 release of the jit it executes about 20 times slower than
a similar construction in C if I create the arrays using:

    import _rawffi
    RAWARRAY = _rawffi.Array('d')
    img=RAWARRAY(640*480, autofree=True)
    intimg=RAWARRAY(640*480, autofree=True)

Using a list is about 40 times slower and using array.array is about
400 times slower. Any suggestion on how to improve the performance of
these kind of constructions?

  Thanx.

-- 
Håkan Ardö



More information about the Pypy-dev mailing list