[Python-Dev] xreadlines : readlines :: xrange : range

Andrew Kuchling akuchlin@mems-exchange.org
Thu, 4 Jan 2001 11:10:29 -0500


On Thu, Jan 04, 2001 at 04:59:25PM +0100, Thomas Wouters wrote:
>Note that I was just guessing there. I did a quick scan of the function, and
>noticed that the ALLOW_THREADS statements had moved into the outer loop. I
>didn't even contemplate whether that made a difference, so don't trust that
>judgement.

According to your benchmark, the performance of the threaded version
was the same whether or not getc_unlocked() was unused, so it's not
that flockfile() is really slow.  I can't believe the compiler
optimized the old, ungainly loop better than the newer, tighter loop.
That leaves the ALLOW_THREADS as the most reasonable culprit.

--amk