comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <no.spam@no.spam.com>
Subject: Re: Dynamically tagged expression required
Date: Wed, 14 Dec 2005 11:22:00 +0100
Date: 2005-12-14T11:22:00+01:00	[thread overview]
Message-ID: <dnoro8$er9$1@sunnews.cern.ch> (raw)
In-Reply-To: <49330337.ekYkZUKDL9@linux1.krischik.com>

Martin Krischik wrote:

>>>Yes. But it only look like the parameter is initialized. Internally the
>>>compiler likely to use a pointer to pass the paramer to speed up things.
> 
>>I don't care. :)
>>I don't want to call something a "pointer" when it isn't in my program.
> 
> I don't care either. But we at c.l.a had to repeat the << "in" is not slower
> then "access" >> mantra so often that we just say it automatily now ;-) .

OK, I see. I think it's "normal" in some way - we (on other forums) are 
busy breaking myths about C++ as well. ;)

As for your mantra - depending on how compiler does its job, "in" might 
be actually *faster* than "access" for the following reason: "access" 
might imply indirection, whereas "in" might be just another (although 
const) name for the actual parameter, especially when the compiler 
inlines the whole call. I don't see anything that would forbid this and 
therefore I wouldn't be surprised to see such "inverse" effects in 
performance measurements. Is this reasoning correct for Ada?

Of course, it is good to follow some coding "wisdom" in order not to 
make things worse or more difficult for the compiler, but AARM 
specifically says that tagged types are passed by reference (6.2). This 
means that passing objects by access variable *only* with hope to get 
better performance would be a premature optimization here (and the root 
of all evil).


-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/



  reply	other threads:[~2005-12-14 10:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-08 13:50 Dynamically tagged expression required Maciej Sobczak
2005-12-08 14:46 ` Georg Bauhaus
2005-12-08 14:52 ` Dmitry A. Kazakov
2005-12-08 19:17 ` Martin Krischik
2005-12-09  9:09   ` Maciej Sobczak
2005-12-09 12:05     ` Jean-Pierre Rosen
2005-12-09 16:41     ` Robert A Duff
2005-12-09 20:18       ` Martin Krischik
2005-12-11  0:43         ` Matthew Heaney
2005-12-11 11:45           ` Martin Krischik
2005-12-11 14:24             ` Matthew Heaney
2005-12-11 15:18               ` Martin Krischik
2005-12-11 18:07             ` Matthew Heaney
2005-12-12 19:16               ` Martin Krischik
2005-12-13 20:43                 ` Georg Bauhaus
2005-12-13 21:00                   ` Georg Bauhaus
2005-12-09 20:41       ` Randy Brukardt
2005-12-09 20:16     ` Martin Krischik
2005-12-11  0:46       ` Matthew Heaney
2005-12-12  9:44       ` Maciej Sobczak
2005-12-12 19:13         ` Martin Krischik
2005-12-14 10:22           ` Maciej Sobczak [this message]
2005-12-15 20:10             ` Martin Krischik
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox