This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] Use getc/putc instead of fgetc/fputc
- From: "François-Xavier Coudert" <fxcoudert at gmail dot com>
- To: "Janne Blomqvist" <blomqvist dot janne at gmail dot com>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 25 Apr 2007 13:57:35 +0200
- Subject: Re: [Patch, fortran] Use getc/putc instead of fgetc/fputc
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=cs9tq82gomRG+0wjU9QOsUZWVmtz7JGfi/g6Abw/mkISrvanTURnvt1GQK0Ct3sTuLvMpc+f7OzVNZY/nSqez3NIuVKANQk6fbl4N8FEgdoT63lf57Bp/yD56/D1nVQw4WjHBy4IwWM1sYrd3Px309tHWrG592lT6CSaeCHfIbY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=QDtTCGF90fkHDHqe4UKnoKkiQbeyFk9ofEQDggCNYnV8f4zMEzECPFbZWudcLjBA+NUNa1wvR64Qm9jCJfQe87zQZY9zK3U04qV5qjbG9YustJfspOuh5Cn6HFK4OvO2wLv4wByRDs0ThDs9XPdzp+AgWT8xVxA81rWPH1hIP+M=
- References: <462F3AB1.1080300@gmail.com>
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