Re: MODULEand USE versus Argument Passing
- From: Herman D. Knoble <SkipKnobleLESS@xxxxxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 13:24:54 -0400
***: I like your reply to my question because it matches what my
gut suspected.
I am quite aware of special array type cases, which show some compiler
dependence, illustrated well by Arnaud Desitter's benchmarks:
http://ftp.aset.psu.edu/pub/ger/fortran/test/FortranArgPassing/results.txt
Besides this, running the (slightly modified) test case formulated by
poster Joost shows that you are correct. (Yield essentially the same
timing results across several compilers under both Windows and Linux)
for three interfaces (Module, Subroutine contained in module, and external
subroutine). My preference would be to use Modules because these
can be more self documenting as well as convenient.
I also agree with you about COMMON being messy to debug, especially
for large codes that do not use INCLUDEs for the COMMON variables and
companion declarations.
Many thanks.
Skip
On Wed, 29 Jun 2005 16:09:38 GMT, *** Hendrickson <***.hendrickson@xxxxxxx> wrote:
-|
-|
-|Herman D. Knoble wrote:
-|
-|> Given a Subprogram that gets called millions of times,
-|> we know that there is (CPU) overhead for subprogram linkage.
-|>
-|> My question is, independent of compilers, which is more efficient
-|> in practice:
-|>
-|> passing a list of (say 3 to 10) arguments to a subprogram's
-|> corresponding parameters,
-|> OR using a Module and companion USE statement,
-|> OR use named COMMON?
-|>
-|> Skip Knoble
-|Seriously, I think the answer is none of the above, it's
-|"whatever makes the most sense to you". If the subroutine
-|does anything significant, then the call overhead is
-|likely to be small either way, and if the subroutine is
-|small (for some definition of small ;) ), turn on inlining
-|and let the compiler figure it out.
-|
-|I once spent a fascinating week debugging someone else's
-|code (I'd never make this kind of mistake ;) ) where
-|there was a
-| COMMON blah blah I,J, blah blah
-|in the main program and a
-| COMMON blah blah J,I, blah blah
-|in the subroutine.
-|
-|Again, seriously, write it in a way that is easiest to
-|understand and don't sweat the small stuff.
-|
-|*** Hendrickson
.
- References:
- MODULEand USE versus Argument Passing
- From: Herman D . Knoble
- Re: MODULEand USE versus Argument Passing
- From: *** Hendrickson
- MODULEand USE versus Argument Passing
- Prev by Date: Re: I have no ideas what can it be!
- Next by Date: Re: MODULEand USE versus Argument Passing
- Previous by thread: Re: MODULEand USE versus Argument Passing
- Next by thread: Re: MODULEand USE versus Argument Passing
- Index(es):