------- Comment #15 from tkoenig at gcc dot gnu dot org 2007-04-02 21:00
-------
The library version doesn't do too badly compared
to the inline version:
$ cat benchmark-inline.f90
program main
implicit none
integer, dimension(1) :: n
real, allocatable :: a(:)
integer :: i
allocate (a(100))
call random_number(a)
do i=1, 10000000
n = minloc(a, dim=1)
end do
end program main
$ cat benchmark-library.f90
program main
implicit none
integer, dimension(1) :: n
real, allocatable :: a(:)
integer :: i
allocate (a(100))
call random_number(a)
do i=1, 10000000
n = minloc(a)
end do
end program main
$ gfortran -O3 -static benchmark-inline.f90 && ./a.out && time ./a.out
real 0m6.941s
user 0m5.232s
sys 0m0.016s
$ gfortran -O3 -static benchmark-library.f90 && ./a.out && time ./a.out
real 0m5.720s
user 0m5.472s
sys 0m0.004s
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31067