From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27961 invoked by alias); 7 Jun 2012 16:03:47 -0000 Received: (qmail 27824 invoked by uid 22791); 7 Jun 2012 16:03:45 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 07 Jun 2012 16:03:33 +0000 From: "talebi.hossein at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/52537] slow trim function Date: Thu, 07 Jun 2012 16:03:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: talebi.hossein at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-06/txt/msg00417.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52537 --- Comment #9 from Hossein Talebi 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