[Bug fortran/38199] New: missed optimization, regression: I/O performance

manfred99 at gmx dot ch gcc-bugzilla@gcc.gnu.org
Thu Nov 20 13:57:00 GMT 2008


With

!234567
      character buffer*10000000
      integer i,j

      DO j=1,20
        write(buffer,'(i2)') j
        write(*,*) buffer(1:2)
        read(buffer,*) i
        write(*,*) i
      ENDDO
      end

I get the following timings:
ifort11 (64bit):               0.306s
ifort9 (32bit):                0.562s
g77 (32bit):                   2.786s
gfortran4.3 (64bit):           3.906s
gfortran4.4 (20081120, 64bit): 4.832s


Even worse:
!234567
      character buffer*100000
      integer i,j

      DO j=1,9999
        write(buffer,'(i4)') j
        write(*,*) buffer(1:4)
        read(buffer,*) i
        write(*,*) i
      ENDDO
      end

ifort11 (64bit):                0.458s
g77 (32bit):                   13.283s
gfortran4.3 (64bit):           19.362s
gfortran4.4 (20081120, 64bit): 23.917s


This is a very realistic real-world scenario when reading
in a flat-file of unknown width (<100000 assumed), and
then processing the received string buffer, i.e. doing
    100 read(10,'(a)',END=999) buffer
        ---> 
        read(buffer,*,END=101,ERR=101) array
    101 do something when unexpected content
        GOTO 100
    999 end


-- 
           Summary: missed optimization, regression: I/O performance
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: manfred99 at gmx dot ch


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38199



More information about the Gcc-bugs mailing list