[patch, libfortran] PR33985 access="stream",form="unformatted" doesn't buffer

Jerry DeLisle jvdelisle@verizon.net
Sat Nov 3 05:59:00 GMT 2007


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;
      }



More information about the Fortran mailing list