program TestProcedurePointer use Subset implicit none integer t1, t2, t_rate, t_max, diff, ii, i_max i_max = 100000 call SetSubset call Subrot1a call Subrot1b call subrot2a(1.0d0) call subrot2b(2.0d0) write (*,*) " " call SwapSubset call Subrot1a call Subrot1b call Subrot2a(1.0d0) call Subrot2b(2.0d0) write (*,*) " " Subrot1a => mySubFoo call mySubFoo call Subrot1a write (*,*) " " call SetSubsetNull write (*,*) "Test1-1: IF statements" call system_clock(t1) do ii=1,i_max if (ii .eq. 0) then call mysub1a endif enddo call system_clock(t2, t_rate, t_max) if ( t2 < t1 ) then diff = (t_max - t1) + t2 + 1 else diff = t2 - t1 endif write (*,*) "Duration: ", diff/dble(t_rate) write (*,*) " " write (*,*) "Test1-2: Dummy calling" call system_clock(t1) do ii=1,i_max call Subrot1a enddo call system_clock(t2, t_rate, t_max) if ( t2 < t1 ) then diff = (t_max - t1) + t2 + 1 else diff = t2 - t1 endif write (*,*) "Duration: ", diff/dble(t_rate) write (*,*) " " write (*,*) "Test2-1: IF statements" call system_clock(t1) do ii=1,i_max if (ii .gt. 0) then call Dummy1 endif enddo call system_clock(t2, t_rate, t_max) if ( t2 < t1 ) then diff = (t_max - t1) + t2 + 1 else diff = t2 - t1 endif write (*,*) "Duration: ", diff/dble(t_rate) write (*,*) " " write (*,*) "Test2-2: Dummy calling" call system_clock(t1) do ii=1,i_max call Subrot1a enddo call system_clock(t2, t_rate, t_max) if ( t2 < t1 ) then diff = (t_max - t1) + t2 + 1 else diff = t2 - t1 endif write (*, *) "Duration: ", diff/dble(t_rate) END PROGRAM TestProcedurePointer subroutine mySubFoo write (*,*) "Calling mySubFoo" end subroutine mySubFoo