This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, libfortran] PR33985 access="stream",form="unformatted" doesn't buffer
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 02 Nov 2007 22:54:37 -0700
- Subject: [patch, libfortran] PR33985 access="stream",form="unformatted" doesn't buffer
Hi,
The following patch regression tests fine on x86-64-Gnu-linux.
With strace with Thomas' example in the PR we now get this:
$ strace -etrace=write ./a.out
write(3,
"\0\1\2\3\4\5\6\7\10\t\n\v\f\r\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37"...,
256) = 256
Writing a 32,000,000 byte file:
Before:
real 1m10.191s
user 0m12.200s
sys 0m57.971s
After
real 0m15.757s
user 0m8.468s
sys 0m7.290s
Thats a 467% improvement.
I plan to commit under the obvious and simple rule some time tomorrow.
No new test case required.
Jerry
Index: transfer.c
===================================================================
--- transfer.c (revision 129791)
+++ transfer.c (working copy)
@@ -2640,9 +2640,11 @@ finalize_transfer (st_parameter_dt *dtp)
if (is_stream_io (dtp))
{
if (dtp->u.p.current_unit->flags.form == FORM_FORMATTED)
- next_record (dtp, 1);
- flush (dtp->u.p.current_unit->s);
- sfree (dtp->u.p.current_unit->s);
+ {
+ next_record (dtp, 1);
+ flush (dtp->u.p.current_unit->s);
+ sfree (dtp->u.p.current_unit->s);
+ }
return;
}