[Patch, fortran] Use getc/putc instead of fgetc/fputc

François-Xavier Coudert fxcoudert@gmail.com
Wed Apr 25 12:20:00 GMT 2007


> 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'm surprised by this difference, especially since it looks like with
glibc, putc is not a macro anyway. I wrote a few pure C testcases, and
could not reproduce that change in timing.

> 2007-04-25  Janne Blomqvist  <jb@gcc.gnu.org>
>
>         * module.c (module_char): Replace fgetc() with
>         getc().
>         (write_char): Replace fputc() with putc().
>         * scanner.c (load_line): Replace fgetc() with getc().
>         (gfc_read_orig_filename): Likewise.

OK if you double-check that it's really faster, consistently over multiple runs.

FX



More information about the Fortran mailing list