[Python-Dev] Rehabilitating fgets

Thomas Wouters thomas@xs4all.net
Thu, 11 Jan 2001 16:28:21 +0100


On Sun, Jan 07, 2001 at 11:13:26PM -0500, Tim Peters wrote:

> I'm curious about how it performs (relative to the getc_unlocked hack) on
> other platforms.  If you'd like to try that, just recompile fileobject.c
> with

>     USE_MS_GETLINE_HACK

> #define'd.  It should *work* on any platform with fgets() meeting the
> assumption.  The new test_bufio.py std test gives it a pretty good
> correctness workout, if you're worried about that.

FreeBSD seems to work fine. Speed is practically the same as without
USE_MS_GETLINE_HACK (but with HAVE_GETC_UNLOCKED), though still not quite
the same as before all this hackery :-) Not by much though. For most tests
it's smaller than the margin of error, though the difference is still as
much as 20, 30% for the while_readline test. When using a second thread
somewhere in the test, the difference vanishes further.

-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!