http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56981
Bug #: 56981 Summary: Slow I/O: Unformatted 5x slower, large sys component; formatted slow as well Classification: Unclassified Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org CC: j...@gcc.gnu.org, jvdeli...@gcc.gnu.org Found at https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.fortran/ORw0Y2k2CI4 The following examples are taken from Robert Corbett. The large amount spend in system for unformatted I/O is surprising, compared with other compilers. But in general, unformatted I/O is much slower. (Formatted I/O is slow as well.) ---- Timing in sec ------------------------------------------------ Unformatted Formatted real / user real / user Compiler ----------- ----------- ----------------------------------------- 1.467/0.448 3.205/2.780 GCC 4.8.0 (-Ofast, 20130308, Rev. 196547) 0.309/0.308 1.297/1.296 g95 4.0.3 (g95 0.93!) Aug 17 2010 (-O3) 0.199/0.188 0.562/0.548 Sun Fortran 95 8.3 Linux_i386 2007/05/03 0.177/0.172 0.904/0.900 PathScale 3.2.99 0.177/0.176 2.201/2.200 NAGWare Fortran 5.1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0.578/0.205 1.229/1.121 GCC 4.9 (trunk, -Ofast) 0.115/0.113 0.517/0.513 g95 4.0.3 (g95 0.94!) Dec 17 2012 0.130/0.129 0.522/0.517 PathScale EKOPath 4.9.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1.035/0.524 3.014/2.928 GCC 4.7.2 20120920 (Cray Inc.) 0.194/0.184 0.634/0.632 Cray Fortran : Version 8.1.6 0.372/0.260 0.703/0.564 Intel 64, Version 13.1.1.163 0.437/0.432 0.938/0.932 pgf90 12.10-0 ------------------------------------------------------------------- PROGRAM MAIN REAL X OPEN (10, FILE='/dev/null', FORM='FORMATTED') X = 0.0 DO 10 I = 1, 1000000 WRITE (10, '(E13.7)') X X = X + 1.0 10 CONTINUE END ------------------------------------------------------------------- PROGRAM MAIN REAL X OPEN (10, FILE='/dev/null', FORM='UNFORMATTED') X = 0.0 DO 10 I = 1, 1000000 WRITE (10) X X = X + 1.0 10 CONTINUE END