Code that ought to run fast, but can't due to Python limitations.
J Kenneth King
james at agentultra.com
Mon Jul 6 11:06:50 EDT 2009
aahz at pythoncraft.com (Aahz) writes:
> In article <mailman.2639.1246802753.8015.python-list at python.org>,
> Hendrik van Rooyen <mail at microcorp.co.za> wrote:
>>
>>But wait - maybe if he passes an iterator around - the equivalent of
>>for char in input_stream... Still no good though, unless the next call
>>to the iterator is faster than an ordinary python call.
>
> Calls to iterators created by generators are indeed faster than an
> ordinary Python call, because the stack frame is already mostly set up.
I think Beazely demonstrated this in his talk on using the python 2.5
co-routines to setup an xml parser. I believe he benchmarked it roughly
and the initial results were rather impressive.
http://www.dabeaz.com/coroutines/
More information about the Python-list
mailing list