[pypy-dev] Win32 build of the release 1.7

Carlos Eduardo carlosedp at gmail.com
Thu Dec 1 18:38:58 CET 2011


Armin Rigo <arigo <at> tunes.org> writes:

> 
> Hi,
> 
> The build has been "officialized" and is now available from
> https://bitbucket.org/pypy/pypy/downloads .
> 
> A bientôt,
> 
> Armin.
> 

I tested the 1.7 release on Windows XP using some Stackless Python examples I 
have.

Most of them worked fine, the only problem is that the performance when using 
Stackless is way slower than the 2.7.1 Stackless build from stackless.com

Here is one example:

Stackless Python 2.7.1

E:\Dev\Python\Scripts\Stackless>\Apps\stackless2.7\python.exe speed.py
Started sleep for 5  seconds.
Started sleep for 0.2  seconds.
Started sleep for 2  seconds.
Started sleep for 1  seconds.
Started sleep for 3  seconds.
100000  operations took:  0.18700003624  seconds.
Woke after  0.2  seconds. ( 0.203000068665 )
200000  operations took:  0.344000101089  seconds.
300000  operations took:  0.5  seconds.
400000  operations took:  0.625  seconds.
500000  operations took:  0.733999967575  seconds.
Woke after  1  seconds. ( 1.0 )
Woke after  2  seconds. ( 2.0 )
Woke after  3  seconds. ( 3.0 )
Woke after  5  seconds. ( 5.0 )

PyPy 1.7

E:\Dev\Python\Scripts\Stackless>..\..\..\sandbox\pypy-1.7\pypy.exe speed.py
Started sleep for 5  seconds.
Started sleep for 0.2  seconds.
Started sleep for 2  seconds.
Started sleep for 1  seconds.
Started sleep for 3  seconds.
Woke after  0.2  seconds. ( 0.234999895096 )
Woke after  1  seconds. ( 1.0 )
Woke after  2  seconds. ( 2.0 )
Woke after  3  seconds. ( 3.0 )
Woke after  5  seconds. ( 5.0 )
100000  operations took:  13.8280000687  seconds.
200000  operations took:  25.25  seconds.
300000  operations took:  34.3599998951  seconds.
400000  operations took:  41.2819998264  seconds.
500000  operations took:  46.015999794  seconds.

Here is the code used:
-------------------------------
import stackless
import time

sleepingTasklets = []
def Sleep(secondsToWait):
    '''
    Yield the calling tasklet until the given number of seconds have passed.
    '''
    channel = stackless.channel()
    endTime = time.time() + secondsToWait
    sleepingTasklets.append((endTime, channel))
    sleepingTasklets.sort()
    # Block until we get sent an awakening notification.
    channel.receive()

def CheckSleepingTasklets():
    '''
    Function for internal uthread.py usage.
    '''
    while stackless.getruncount() > 1 or sleepingTasklets:
        if len(sleepingTasklets):
            endTime = sleepingTasklets[0][0]
            if endTime <= time.time():
                channel = sleepingTasklets[0][1]
                del sleepingTasklets[0]
                # We have to send something, but it doesn't matter what as it is 
not used.
                channel.send(None)
        stackless.schedule()
stackless.tasklet(CheckSleepingTasklets)()

def doStuff(mult=1):
    st = time.time()
    c = 0
    for i in xrange(int(100000*mult)):
        c = c + 1
        stackless.schedule()
    print 100000*mult, " operations took: " , time.time() - st , " seconds."


def sleepalittle(howmuch):
    print "Started sleep for", howmuch, " seconds."
    st = time.time()
    Sleep(howmuch)
    print "Woke after ", howmuch, " seconds. (", time.time()-st, ")"


stackless.tasklet(doStuff)(1)
stackless.tasklet(sleepalittle)(5)
stackless.tasklet(sleepalittle)(0.2)
stackless.tasklet(doStuff)(2)
stackless.tasklet(doStuff)(3)
stackless.tasklet(sleepalittle)(2)
stackless.tasklet(sleepalittle)(1)
stackless.tasklet(sleepalittle)(3)
stackless.tasklet(doStuff)(4)
stackless.tasklet(doStuff)(5)


stackless.run()

-------------------------------
Probably this is due to JIT being disabled when using Stackless features.

Other than the performance, it's working fine with the examples I tested from: 
http://code.google.com/p/stacklessexamples/

Congratulations for the great work.



More information about the pypy-dev mailing list