Microthreads

David Mertz mertz at gnosis.cx
Mon May 19 01:50:59 EDT 2003


"Gary Richardson" <garyr at fidalgo.net> wrote previously:
|shorter run times for the microthread script without [freeware tool].
|I've not been able to reproduce the 40 seconds I was seeing yesterday -
|I don't know what to make of that.  Now when run from a DOS box I'm
|seeing times of 17 to 19 seconds and 22 to 24 seconds when run from
|within PythonWin. I guess I can live with that.

My example and running times were not meant as any very precise
guarantee of timings across CPUs, OSs and Python versions.  The overall
point was just that "A large number of microthreads can be MUCH faster
than a similarly large number of weighty threads."  The times other
folks have posted seem consistent with what I found (most of them used
faster CPUs, with roughly proportionally lower times).

But living with (or not) the 17-24 seconds for the test script is
slightly odd.  It's not exactly USEFUL to create 100k do-nothing
threads, and switch among them a million times.  So whether those
switches take 1 or 100 seconds is not overwhelmingly important.  Assuming
a more realistic application spends at least a few milliseconds within
each context, the overall runtime will swamp the switching time, in
any case.

Yours, David...

--
mertz@  | The specter of free information is haunting the `Net!  All the
gnosis  | powers of IP- and crypto-tyranny have entered into an unholy
.cx     | alliance...ideas have nothing to lose but their chains.  Unite
        | against "intellectual property" and anti-privacy regimes!
-------------------------------------------------------------------------






More information about the Python-list mailing list