[Patches] [Patch #103082] speed up readline() using getc_unlocked()

noreply@sourceforge.net noreply@sourceforge.net
Wed, 03 Jan 2001 13:27:43 -0800


Patch #103082 has been updated. 

Project: python
Category: core (C code)
Status: Open
Submitted by: gvanrossum
Assigned to : nobody
Summary: speed up readline() using getc_unlocked()

Follow-Ups:

Date: 2001-Jan-03 13:27
By: gvanrossum

Comment:
Thanks for the feedback.  Here's a version with a custom autoconf test.
Note: YOU MUST RUN BOTH AUTOCONF AND AUTOHEADER (and then ./configure of
course).

Let me know if this works on Solaris!
-------------------------------------------------------

Date: 2001-Jan-03 13:05
By: akuchling

Comment:
On Solaris 2.6, getc_unlocked() and friends are present, but not detected
by the configure script.  config.log reports:

configure:5957: checking for flockfile
configure:5985: gcc -o conftest -g -O2   conftest.c -lpthread -lsocket
-lnsl -ldl  -lthread 1>&5
configure:5969: conflicting types for `flockfile'
/usr/include/stdio.h:311: previous declaration of `flockfile'
configure: failed program was:
#line 5962 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char flockfile(); below.  */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char flockfile();
 
int main() {     ... rest deleted

For getc_unlocked, config.log contains:
configure:5957: checking for getc_unlocked
configure:5985: gcc -o conftest -g -O2   conftest.c -lpthread -lsocket
-lnsl -l
l  -lthread 1>&5
configure:5969: macro `getc_unlocked' used without args
configure:5979: macro `getc_unlocked' used without args
configure: failed program was:
#line 5962 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char getc_unlocked(); below.  */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char getc_unlocked();
 
int main() {  ... rest deleted

Python still compiles, but obviously you gain no benefit from it.
Do we need to write custom autoconf tests for these functions?
                                                                           
    
-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=103082&group_id=5470