This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

More about gfortran & comparison with g77



Well I'm afraid I'm back with my writing problems...


The following program :

program io_try
implicit none
integer :: i, n = 1000000
open(1,file='io_try.out')
do i = 1, n
    write(1,'(i7)') i     ! just write a lot of junk
enddo
close(1)
end

compiled with g77:

 g77 -O3 -ffree-form io_try.f -o io_try
 time io_try

real    0m1.048s
user    0m1.002s
sys     0m0.022s

compiled with gfortran
 gfortran -O3 -ffree-form io_try.f -o io_try
 rm io_try.out
 time io_try

real    0m2.041s
user    0m2.007s
sys     0m0.034s

time io_try

real    0m32.868s
user    0m10.892s
sys     0m21.969s

 g77 -O3 -ffree-form io_try.f -o io_try
 time io_try

real    0m1.010s
user    0m0.991s
sys     0m0.018s


To summarize, gfortran takes twice as much time as g77 writing stuff to a file (two first examples).
But, on top of that, it is 10 times slower when the result file already exists (taking in account user time only, but sys time also shows large
differences), whereas g77 is insensitive to the existence of an old
result file...


I'm afraid I have no idea of the reasons for that.

I have also noticed that a program compiled with g77 will not only
overwrite an existing file but erase all previous data (even if the new
file is shorter that the old one), whereas a gfortran compiled program
will only overwrite and, when the new file is shorter leave previous
results. I don't know whether that is relevant.


Regards,


Philippe Depondt                                    dep@ccr.jussieu.fr
# INSP                             Institut des Nano-Sciences de Paris
# Universite P. et M. Curie, Casier 86, 140 rue de Lourmel 75015 Paris
# Site Boucicaut : Bat. 2, 1er etage piece 4       Tel: 01 44 27 42 33


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]