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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,13c7ec19f3c43155 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!p25g2000pri.googlegroups.com!not-for-mail From: "jhc0033@gmail.com" Newsgroups: comp.lang.ada Subject: Re: speed of generic code in Ada (vs Java) Date: Fri, 16 May 2008 18:50:47 -0700 (PDT) Organization: http://groups.google.com Message-ID: <24bf14ef-ff0f-4309-88e0-550cd4a0dd9d@p25g2000pri.googlegroups.com> References: <9e9bdae7-5e91-4e0c-b783-1ed72311a733@t12g2000prg.googlegroups.com> <2e1de55a-69e5-439e-addc-bde650b4c16a@i36g2000prf.googlegroups.com> <87wsluulj4.fsf@ludovic-brenta.org> NNTP-Posting-Host: 75.26.46.184 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1210989047 17652 127.0.0.1 (17 May 2008 01:50:47 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 17 May 2008 01:50:47 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p25g2000pri.googlegroups.com; posting-host=75.26.46.184; posting-account=ZDEUcwoAAAAfEl68GET6fODebgE-CIe2 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:134 Date: 2008-05-16T18:50:47-07:00 List-Id: On May 16, 11:54 am, Ludovic Brenta wrote: > jimmaureenrogers writes: > > On May 16, 11:31 am, "jhc0...@gmail.com" wrote: > >> Java only allows 'objects' as generics parameters. So, if you define a > >> generic class and use 'Integer' as a parameter, your code will be slow > >> because of the boxing - up to 5x compared to non-generic Int (see the > >> recent discussion in comp.lang.java.programmer - the 'numerics' > >> thread). Is the situation similar with generics in Ada, GNAT, > >> specifically? > > > No. > > To add to Jim's excellent answer: Ada got it right the first time, > back in 1980. > So, if I write a, say, linear equation solver using generics in Ada, and then instantiate it with single precision, double precision, complex number single precision and complex number double precision, you'd expect it to be as fast as the equivalent non-generic versions?