[Patch, fortran] Use getc/putc instead of fgetc/fputc
Jakub Jelinek
jakub@redhat.com
Wed Apr 25 12:06:00 GMT 2007
On Wed, Apr 25, 2007 at 02:25:37PM +0300, Janne Blomqvist wrote:
> :ADDPATCH fortran:
>
> the attached patch converts the gfortran frontend to use getc/putc
> instead of fgetc/fputc.
>
> In normal cases there's no difference, but in pathological cases like
> e.g. the example program from PR21130 this patch shaves about 5-10s of
> the 90s runtime.
>
> I also tried to use the _unlocked stdio functions, but there was no
> difference. It seems the build system is clever enough to substitute the
> _unlocked versions automatically when building a single-threaded program.
Look at gcc/system.h, which if configure detects e.g. getc_unlocked
it redefines getc for use in gcc as getc_unlocked etc.
The difference is most probably just in getc_unlocked being implemented
inline, whereas fgetc_unlocked is not.
Jakub
More information about the Gcc-patches
mailing list