[Stackless] Stackless 3.0 alpha 1 at blinding speed
Christian Tismer
tismer at tismer.com
Sat Apr 19 05:30:01 CEST 2003
Hi Peter,
> That's amazing. 20M switches / second. For kicks, I checked out the
> latest CVS version and ran the taskspeed.py on my Windows desktop and
> my Solaris system at the office. Here are the numbers:
Impressive and very well. Especially this shows how much more
efficient soft-switching is on certain platforms.
...
> Can I inquire on the type of system that you achieved the 20M switches /
> second? Also, can I assume that the basic stackless API that's in the 3.0
> alpha is reasonably stable? I've some simulation ideas that I'd like to
> try out using it and have been waiting for the 3.0 version to come out
> before I spend too much time coding.
AMD Athlon(tm)XP 2000+
1.67 GHz
1.00 GB RAM
80 GB RAID-0 2 disks
On the basic API:
Yes, you can assume that it is almost stable. There might be
a little change: I'm considering to change tasklet.run() in
a way that the calling tasklet gets suspended until the runn'ed
tasklet is done. This appears to be much more what people are
expecting.
The internal API is still under heavy changes. I'm reducing and
simplifying like hell, trying to avoid as much frame flags
ugliness as possible, I'm trying to make every frame exception
aware in any context, even in the startup phase...
...
>>D:\slpdev\src\2.2\src\Stackless\test>..\..\pcbuild\python taskspeed.py
>>10000000 frame switches took 3.83061 seconds, rate = 2610551/s
>>10000000 frame softswitches took 2.40112 seconds, rate = 4164718/s
>>10000000 cfunction calls took 2.13033 seconds, rate = 4694098/s
>>10000000 cframe softswitches took 0.49296 seconds, rate = 20285627/s
>>10000000 cframe switches took 1.98907 seconds, rate = 5027486/s
>>10000000 cframe 100 words took 3.93737 seconds, rate = 2539768/s
>>The penalty per stack word is about 0.980 percent of raw switching.
>>Stack size of initial stub = 14
>>Stack size of frame tasklet = 58
>>Stack size of cframe tasklet = 35
Here the new numbers, after I cleaned up the testing code. It is now
responding to exceptions, which made it a little slower, and it also
supports both soft and hard switching at the same time now:
D:\slpdev\src\2.2\src\Stackless\test>..\..\pcbuild\python taskspeed.py
10000000 frame switches took 3.71814 seconds, rate = 2689518/s
10000000 frame softswitches took 2.30548 seconds, rate = 4337488/s
10000000 cfunction calls took 2.08869 seconds, rate = 4787683/s
10000000 cframe softswitches took 0.49931 seconds, rate = 20027656/s
10000000 cframe switches took 1.92118 seconds, rate = 5205136/s
10000000 cframe 100 words took 3.65009 seconds, rate = 2739655/s
The penalty per stack word is about 0.900 percent of raw switching.
Stack size of initial stub = 14
Stack size of frame tasklet = 58
Stack size of cframe tasklet = 34
Here is the code for the test_cframe_nr running loop. It always checks
for a NULL result, it instruments being called periodically by
soft-switches, but it is also prepared to be run by hard switching.
static
PyObject *
test_cframe_nr_loop(PyFrameObject *f)
{
PyCFrameObject *c = (PyCFrameObject *) f;
PyObject *result = f->f_retval;
if (result == NULL) {
f->f_tstate->frame = f->f_back;
return NULL;
}
while (c->f_flags.user_num-- > 0) {
switch (PyStackless_Schedule_nr()) {
case -1:
f->f_tstate->frame = f->f_back;
return NULL;
case 1:
Py_DECREF(result);
return Py_UnwindToken;
}
}
f->f_tstate->frame = f->f_back;
return result;
}
--
Christian Tismer :^) <mailto:tismer at tismer.com>
Mission Impossible 5oftware : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34 home +49 30 802 86 56 pager +49 173 24 18 776
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
_______________________________________________
Stackless mailing list
Stackless at www.tismer.com
http://www.tismer.com/mailman/listinfo/stackless
More information about the Stackless
mailing list