Hi all,
I have some questions about the recursive functions performance in the compiler.
The code is below, the performance table obtains with the compiler 14. First column is normal, second column is pass by value.
Ifort is slower than gfortran(4.8.2), and is passing by reference creating more copies in the recursive case ?
I don't know if performance is better with old compiler version.
Thanks.
ifort 3.51 1.151
gfortran 2.027 0.452
program ackermann implicit none write(*,*) ack(3, 12) contains recursive function ack(m, n) result(a) integer, intent(in) :: m,n integer :: a if (m == 0) then a=n+1 else if (n == 0) then a=ack(m-1,1) else a=ack(m-1, ack(m, n-1)) end if end function ack end program ackermann