home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!munnari.oz.au!metro!wonga
- From: wonga@chem.su.oz.au ()
- Subject: Performance diff between passed and stack arrays
- Message-ID: <1992Aug31.070836.541@ucc.su.OZ.AU>
- Sender: news@ucc.su.OZ.AU
- Nntp-Posting-Host: steam.chem.su.oz.au
- Organization: Sydney University Computing Service, Sydney, NSW, Australia
- X-Newsreader: Tin 1.1 PL4
- Date: Mon, 31 Aug 1992 07:08:36 GMT
- Lines: 34
-
- For medium to large sized arrays, is there any difference in performance
- between an array passed from main & creating the array within the subroutine
- on the stack? I realize that for very large arrays there is some default
- stacksize that it might exceed, where performance may be degraded. (my
- compiler informs me of this) but could this extrapolated back to smaller
- arrays. I.e. does smaller stacksizes neccessarily imply better perforamnce?
-
- Is there any difference between an array declared in main's stack and
- one given common storage.
-
- This sort of dilemma is a continual source of headaches for which it
- seems there are three options:
-
- i) Pass portions of blank common to the subroutines to use as
- workspace. This leads to lengthy parameter lists and messy
- indexing arithmetic.
-
- ii) Declare the temporary arrays in the subroutine itself.
- This is apparently not suitable for large arrays and for arrays
- where the required dimensions is not known in advance.
-
- iii) Use blank common in the subroutine, however
- once again dynamic setting of array lengths is not possible.
-
- Without resorting to dynamic memory allocation, I would say (i) was the
- preferred option since the main module can abort the program if the
- size of the problem is too big and the other modules can be independent
- of PARAMETER statements. However, 90% of my main modules are invariably
- devoted to indexing/memory arithmetic.
-
- I would be interested to hear how others tackle this problem.
- -----------------------------------------------------------------------------
- Adrian Wong, Dept.of Theoretical Chemistry wong_a@summer.chem.su.oz.au
- University of Sydney NSW 2006 Australia 061-2-692 4137
-