Slow network reading?

Ivan Voras ivoras at __-yahoo-__.com_
Sat May 13 16:50:49 EDT 2006


Andrew MacIntyre wrote:

>> That's only because I need the .readline() function. In C, I'm using 
>> fgets() (with the expectation that iostream will buffer data).
> 
> The readline method of the file object lookalike returned by makefile
> implements all of the line splitting logic in Python code, which is very
> likely where the extra process CPU time is going.  Note that this code is

Heh, I didn't know that - you're probably right about this being a 
possible bottleneck.

> in Python for portability reasons, as Windows socket handles cannot be
> used as file handles the way socket handles on Unix systems can be.

I think they actually can in NT and above... but no, I'm doing it on Unix.

> Given your comments above about how much data is actually involved, I'm
> a bit surprised that the tweaked version actually produced a measurable
> gain.

I didn't do statistical analysis of the results so the difference 
actually could be negligable IRL.

Anyway, thanks for the advice - I'll leave it as it is, as the Python 
client is not used currently.

-- 
Things Mr Welch Cannot Do During An RPG:
274. I cannot commune with the Gods during peak hours.



More information about the Python-list mailing list