Path: utzoo!attcan!uunet!mcsun!cernvax!rbt From: rbt@cernvax.UUCP (roberto divia) Newsgroups: comp.os.os9 Subject: Re: Passing parameters by registers is bad use?!?!? Keywords: C compiler, parameter passing Message-ID: <2855@cernvax.UUCP> Date: 11 Oct 90 07:23:24 GMT References: <2823@cernvax.UUCP> <3555@rwthinf.UUCP> <3574@rwthinf.UUCP> Organization: CERN, European Laboratory for Particle Physics Lines: 17 This might go on forever... I have looked at some of my code (mostly written for real time applications) and noticed how often I have used routines with one or two input parameters and the output value. I also did some tests where the same routine was called with parameters on stack and parameters in registers and found that the second case is MUCH faster. My tests where executed on a MC68030 (program and data caches). The simple fact of passing one or two of 6 parameters (or more) into registers reduced the execution time of 10 to 20 %. To see why, I tried different combinations. In particular, when I turned OFF the data cache, the speed gain was much less (2, 3%). This because the data region used by the program was somehow "extended" by the use (or better - the abuse) of the data stack made during subroutine calls. Try to believe... -- | Roberto Divia` | Love at first sight is one of the greatest | | ============= | labor-saving devices the world has ever seen | | CERN : European Laboratory for Particle Physics, 1211 Geneva 23 | | Switzerland (CH) |