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.9 required=5.0 tests=BAYES_00 autolearn=ham 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 Date: Sat, 17 May 2008 23:37:36 +0200 From: Gautier User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: speed of generic code in Ada (vs Java) References: <9e9bdae7-5e91-4e0c-b783-1ed72311a733@t12g2000prg.googlegroups.com> <2e1de55a-69e5-439e-addc-bde650b4c16a@i36g2000prf.googlegroups.com> <87wsluulj4.fsf@ludovic-brenta.org> <24bf14ef-ff0f-4309-88e0-550cd4a0dd9d@p25g2000pri.googlegroups.com> In-Reply-To: <24bf14ef-ff0f-4309-88e0-550cd4a0dd9d@p25g2000pri.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 85.1.159.90 X-Original-NNTP-Posting-Host: 85.1.159.90 Message-ID: <482f5009$1_3@news.bluewin.ch> X-Trace: news.bluewin.ch 1211060233 85.1.159.90 (17 May 2008 23:37:13 +0200) Organization: Bluewin AG Complaints-To: abuse@bluewin.ch X-Original-NNTP-Posting-Host: 127.0.0.1 Path: g2news1.google.com!news3.google.com!feeder.news-service.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed-0.progon.net!progon.net!news-zh.switch.ch!switch.ch!news.ip-plus.net!newsfeed.ip-plus.net!news.bluewin.ch!not-for-mail Xref: g2news1.google.com comp.lang.ada:176 Date: 2008-05-17T23:37:36+02:00 List-Id: jhc0033@gmail.com wrote: > 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? Exactly. For my PhD research I used generics to fill matrices with Finite Element integrals, whatever the format. It allowed to use the band format and Lapack for some problems and a sparse format and a totally different solver for other problems. The compiler (DEC Ada, now HP Ada) allowed to share (or not) generic instantiations. AFAIK, the GNAT compiler always expands generics like macros and never shares, so you have something as fast as a copy-paste-modify non-generic code. __________________________________________________________________ Gautier's Ada programming -- http://sourceforge.net/users/gdemont/ NB: For a direct answer, e-mail address on the Web site!