Path: utzoo!mnetor!uunet!husc6!mailrus!ames!pasteur!ucbvax!INDYVAX.BITNET!IMHW400 From: IMHW400@INDYVAX.BITNET Newsgroups: comp.os.vms Subject: Re: 2 C questions Message-ID: <8804111028.AA23176@ucbvax.Berkeley.EDU> Date: 8 Apr 88 19:14:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 22 Regarding relative speed of C and FORTRAN code: no, you can't assume that dynamic allocation takes significantly more time. Most VAX languages "allocate" dynamic local storage by assuming that the stack has enough space left and defining their addresses relative to the stack pointer. The runtime overhead involved is a single MOVAx instruction with registers for source and destination, plus indirection overhead. Depending on the degree of overlap during instruction decoding for the particular machine, the indirection overhead could in fact be zero. So, the best-case cost for stack allocation is one very brief instruction per CALL. So the overhead may hold academic interest, but no real practical interest. On the other hand, IF your machine uses a significant amount of time for each indirection, AND the FORTRAN compiler is using absolute rather than PC-relative addressing (probably not!) then the overhead in C might become significant. But if it is really causing you grief, you probably have refined your code into too many itty-bitty subroutines. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Mark H. Wood IMHW400@INDYVAX.BITNET (317)274-0749 III U U PPPP U U III Indiana University - Purdue University at Indianapolis I U U P P U U I 799 West Michigan Street, ET 1023 I U U PPPP U U I Indianapolis, IN 46202 USA I U U P U U I [@disclaimer@] III UUU P UUU III