From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,af42f89f2159f3b6 X-Google-Attributes: gid103376,public From: pontius@btv.ibm.com (Dale Pontius) Subject: Re: A note on GNAT 3.05 performance Date: 1996/06/24 Message-ID: <4qm21c$qig@mdnews.btv.ibm.com>#1/1 X-Deja-AN: 161832298 references: organization: IBM Microelectronics Division newsgroups: comp.lang.ada Date: 1996-06-24T00:00:00+00:00 List-Id: In article , dewar@cs.nyu.edu (Robert Dewar) writes: >We have discovered a very significant performance issue in GNAT 3.05. It is >not exactly a bug, but it is certainly a very undesirable inefficiency. > >Up to now, we have always arranged that the default calling sequence for >Ada should be the same as C. > >We discovered that there was one respect in which we did not follow this >rule in GNAT 3.04, namely we did not pass records in a manner consistent >with C. In C if you pass a record, a copy is always made, so that the >caller can mess with the record without changing the value in the caller. > >So, we "fixed" this "bug". > >The trouble is that the result is that all records get copied on calls >to all Ada subprograms. This has pretty significant efficiency consequences. >For example, all unbounded and bounded strings are records. > When I first began looking at Ada, I wondered if if was 'pass by value' or 'pass by reference'. The answer was, apparently, 'neither and both'. It seemed to me that Ada was attempting to 'idealize' a concept by using copy-in/copy-out that it shouldn't be. Now maintaining copy-in and copy-out will apparently have a performance penalty, yet changing that aspect to pass-by-reference will not be consistant with regular 'in' parameter passing. Are Ada pragmas frozen in concrete the way the rest of the language is? Is it feasible to make 'pass by copy' and 'pass by reference' for record parameters adjustable on a pragma basis? Is it desirable? Thanks, Dale Pontius (NOT speaking for IBM)