[Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/test taskspeed.py, 1.25, 1.26
Christian Tismer
tismer at centera.de
Mon Jul 12 20:56:58 CEST 2004
Update of /home/cvs/slpdev/src/2.3/dev/Stackless/test
In directory centera.de:/tmp/cvs-serv18053/Stackless/test
Modified Files:
taskspeed.py
Log Message:
A tiny optimization of oparg fetching for X86.
Mainly I started optimizing by keeping interpreters on the stack.
This is just a cache-like optimization and gives a few percent.
But I think it will really count for generator/iterator situations.
Index: taskspeed.py
===================================================================
RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/test/taskspeed.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** taskspeed.py 10 Jul 2004 01:30:40 -0000 1.25
--- taskspeed.py 12 Jul 2004 18:56:55 -0000 1.26
***************
*** 102,105 ****
--- 102,132 ----
send(42); send(42); send(42); send(42); send(42);
+ # alternate, for real application cases
+
+ def channel_sender(chan, nest=0, bulk=0):
+ if nest:
+ return channel_sender(chan, nest-1)
+ if bulk:
+ data = range(20)
+ send_seq = chan.send_sequence
+ send_exc = chan.send_exception
+ def yielder():
+ while 1:
+ yield 1; yield 1; yield 1; yield 1; yield 1;
+ yield 1; yield 1; yield 1; yield 1; yield 1;
+ yield 1; yield 1; yield 1; yield 1; yield 1;
+ yield 1; yield 1; yield 1; yield 1; yield 1;
+ send_exc(StopIteration)
+ # while 1:
+ # send_seq(yielder())
+ # send_exc(StopIteration)
+ send_seq(yielder())
+ send = chan.send
+ while 1:
+ send(42); send(42); send(42); send(42); send(42);
+ send(42); send(42); send(42); send(42); send(42);
+ send(42); send(42); send(42); send(42); send(42);
+ send(42); send(42); send(42); send(42); send(42);
+
def chantest(n, nest=0, use_thread=False, bulk = False):
if nest:
***************
*** 147,150 ****
--- 174,187 ----
if args_given:
niter = args_given
+
+ # clear out every runnable that may be left over from something
+
+ if IS_SLP:
+ while stackless.runcount > 1:
+ try:
+ stackless.current.next.kill()
+ except:
+ print "*** GHOST ALERT ***"
+ raise
enable_softswitch(0)
_______________________________________________
Stackless-checkins mailing list
Stackless-checkins at stackless.com
http://www.stackless.com/mailman/listinfo/stackless-checkins
More information about the Stackless-checkins
mailing list