* Ada Generic Overhead Inquiry
@ 1987-04-08 18:17 adaisc
1987-04-09 13:59 ` firth
0 siblings, 1 reply; 4+ messages in thread
From: adaisc @ 1987-04-08 18:17 UTC (permalink / raw)
................................................................
Can anybody tell me if there is any significant, run-time
overhead associated with the use of Ada's Generics?
Thanks,
Joe Rubel <byrley@ntsc-74>
................................................................
------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Ada Generic Overhead Inquiry
@ 1987-04-08 20:21 CPT Jacques C. Choiniere
1987-04-09 11:44 ` mdash
0 siblings, 1 reply; 4+ messages in thread
From: CPT Jacques C. Choiniere @ 1987-04-08 20:21 UTC (permalink / raw)
In reply to Joe Rubel, on run-time overhead associated with Ada Generics:
Tim Porter of SAIC ((porter@nosc-tecr)) did some work for us that explored
this issue. His team developed an automatic code generator that, among other
things, uses Ada generics. This work was done for WWMCCS Information System,
and is public domain software that will be sent to the Ada Repository on Simtel
20 in the next several months. A formal report on this work is in the
Proceedings of the Joint Ada Conference, 5th National Conference & Washington
Ada Symposium pages 334 to 343.
In sum, he found that speed of the applications code was not noticeably
different from "regular" code when running the compiled code. Compilation
speed was fairly slow with the large system his team worked with (see report).
The PROBLEM he found was the size of the Ada code modules created by the
automatic code generator and the generics it used. The compiled code was
big. He told me that this was a function of current VAX Compiler technology
and NOT a function of the Ada language. The Compiler did not share any code
at all, even when the modules were identical. THIS PROBLEM WAS SOLVED BY
TIM. With careful selections of implementation alternatives (see report or
send him a note) he was able to shrink the generated code size and (I forgot
to mention this problem) handle the problem of in-line expansions of generics.
BY ALL MEANS READ THE REPORT OR TALK TO TIM TO GET THE DETAILS.
CPT CHOINIERE, USA
WIS JPMO/XPT
jcc@mitre
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Ada Generic Overhead Inquiry
1987-04-08 20:21 CPT Jacques C. Choiniere
@ 1987-04-09 11:44 ` mdash
0 siblings, 0 replies; 4+ messages in thread
From: mdash @ 1987-04-09 11:44 UTC (permalink / raw)
Runtime overhead of generics is implementation-dependent. The
issue is the degree of interpretation done by the code body.
This is determined by the restrictions on instantiations set
by generic formal type parameters, and whether the implementation
chooses to instantiate via code sharing or macro-style expansion.
I believe that most current implementations do limited code sharing
for generic instantiations. Expect a low runtime TIME overhead for
generics, and a correspondingly high SPACE penalty.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Ada Generic Overhead Inquiry
1987-04-08 18:17 Ada Generic Overhead Inquiry adaisc
@ 1987-04-09 13:59 ` firth
0 siblings, 0 replies; 4+ messages in thread
From: firth @ 1987-04-09 13:59 UTC (permalink / raw)
In article <8704090138.AA12598@ucbvax.Berkeley.EDU> "Paul Byrley" <adaisc@ntsc-74> writes:
> Can anybody tell me if there is any significant, run-time
> overhead associated with the use of Ada's Generics?
>
With the current state of Ada compiler maturity, this very
much depends on the compiler. However, here are a few
general comments that I hope are of use - at least they
might tell you what to look for!
One way of implementing generics is by replicating the code
at each instantiation. This has no runtime overhead, since
the effect should be just as if you had written dozens of
non-generic bodies. It can cause enormous code expansion,
for which reason you might prefer to look for compilers
that don't do that.
Code sharing may or may not cause overhead, depending on
the generic parameter types:
(a) Pure type parameters should cause no overhead - the
shared body is exactly what would be used for a non
generic. However, watch for things like
if FORMAL_TYPE'MANTISSA < 20 then ...
which are compile-time evaluable in the non-generic
case but may require major overhead in a shared body.
(b) Procedure parameters require a procedure descriptor to
be passed. The minimum is normally 2 values - code
address and static environment chain pointer. If there
are more than 3 values passed then I think you should
worry.
(c) Value parameters appear in the code body as initialised
constants. You possibly lose some value-tracking
optimisation.
(d) Subtype parameters may have to pass constraint information.
That costs, and you also may lose some optimisations.
If you want the specific detail for the compiler of your
choice, then ask
A: under precisely what circumstances is code shared between
instantiations?
B: when code is shared, what is the runtime representation of
. procedures
. values and objects
. subtype constraints
. type attributes
that might have to be passed to the body
C: what specific optimisations are inhibited as a result of
code sharing.
Hope this helps.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1987-04-09 13:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1987-04-08 18:17 Ada Generic Overhead Inquiry adaisc
1987-04-09 13:59 ` firth
-- strict thread matches above, loose matches on Subject: below --
1987-04-08 20:21 CPT Jacques C. Choiniere
1987-04-09 11:44 ` mdash
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox