[Bug libfortran/52537] slow trim function

talebi.hossein at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jun 7 16:03:00 GMT 2012


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

--- Comment #9 from Hossein Talebi <talebi.hossein at gmail dot com> 2012-06-07 16:03:09 UTC ---
I think I found where the problem is. It is not with the trim(). It is mostly
with read (st_input_all(j),*,IOSTAT=ios) I50(1:50).

I attach a self contained program. With intel it takes 11sec but for gfortran
takes 40sec. The input file is 404MB.



program fileread

    integer :: linenum
    integer  :: j,ferror, ios,i
    character (len=200) :: st_input
    character (len=200) :: st_input_all(5373122)
    integer :: funit2
    integer :: I50(0:50)
    integer   G_elid, nn !, pEidf, pEconnf,pEmatidf
    integer, allocatable :: element_tab(:), Elements(:,:)

    linenum=0; ferror=0;
    open (funit2, file = "/data/msh/bigmesh.elements", access =
'sequential',iostat=ferror)

    if (ferror/=0) then
        STOP "error reading the file"
    endif

    print *, "reading the file..."

    G_elid=0
    do j=1,5373122
        read (funit2,"(A200)",iostat=ferror) st_input_all(j)
        if (G_elid== 5373121 ) then
            print *,  st_input_all(j)
        endif        
    enddo

    G_elid=0
    do j=1,5373122
        G_elid=G_elid+1
        read (st_input_all(j),*,IOSTAT=ios) I50(1:50)
        if (G_elid== 5373121 ) then
            print *,  I50
        endif
    enddo

    close(funit2)
    print *, I50
    STOP "permix I am stopped"

end program fileread



More information about the Gcc-bugs mailing list