Re: MODULEand USE versus Argument Passing
- From: "Joost" <jv244@xxxxxxxxx>
- Date: 29 Jun 2005 07:36:52 -0700
I don't think you can see this independent of the architecture, the
compilers, the kind of arguments and so on and so forth. Just a simple
benchmark shows that in that specific case, passing 10 arguments is
actually faster (ia32, ifort):
output:
Module 0.285956000000000
Arguments 0.250962000000000
code:
MODULE M1
INTEGER :: a,b,c,d,e,f,g,h,i,j
CONTAINS
SUBROUTINE S1()
a=a*b*c*d*e*f*g*h*i*j
END SUBROUTINE S1
SUBROUTINE S2(a,b,c,d,e,f,g,h,i,j)
INTEGER :: a,b,c,d,e,f,g,h,i,j
a=a*b*c*d*e*f*g*h*i*j
END SUBROUTINE S2
END MODULE M1
USE M1
INTEGER :: k
REAL*8 :: t1,t2,t3,t4
a=0 ; b=0 ; c=0 ; d=0 ; e=0 ; f=0;
g=0 ; h=0 ; i=0 ; j=0
CALL CPU_TIME(T1)
DO k=1,10000000
CALL S1()
ENDDO
CALL CPU_TIME(T2)
write(6,*) "Module ",T2-T1
CALL CPU_TIME(T1)
DO k=1,10000000
CALL S2(a,b,c,d,e,f,g,h,i,j)
ENDDO
CALL CPU_TIME(T2)
write(6,*) "Arguments ",T2-T1
END
Cheers,
Joost
.
- Follow-Ups:
- Re: MODULEand USE versus Argument Passing
- From: Herman D . Knoble
- Re: MODULEand USE versus Argument Passing
- References:
- MODULEand USE versus Argument Passing
- From: Herman D . Knoble
- MODULEand USE versus Argument Passing
- Prev by Date: Re: MODULEand USE versus Argument Passing
- Next by Date: Re: Halt execution procedure
- Previous by thread: Re: MODULEand USE versus Argument Passing
- Next by thread: Re: MODULEand USE versus Argument Passing
- Index(es):
Relevant Pages
|