100,000 tasklets: Stackless and Go
They have a good example where the chain of 100,000 microthreads each pack the same function that increases the value of an argument passed by one, with channels inbetween. Pumping through a value chain takes 1.5 seconds. I can not imagine that stackless is something like this, given the difference between script and compiled code. I was curious, so I wrote something that suggested that stackless Python was much faster than Go for this task. That was on a benchmark of my own invention, based on reading the comment by Richard.Yesterday I finally tracked down the code and wrote a direct translation in stackless: import stackless from optparse import OptionParser parser = OptionParser () parser.add_option ( "-n", type = "int", dest = "num_tasklets", help = "quanta", default = 100000) def f (left to right): left.send (right.receive () +1) def main (): options, args = parser.parse_args () left = stackless.channel ( ) to the left, right = None, than left to the in xrange (options.num_tasklets): left, right = right, stackless.channel () stackless.tasklet (f) (left, right) right.send (0 ) x = leftmost.receive () print x stackless.tasklet (main) () stackless....


