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,f03ffdf470e3c559 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news.glorb.com!transit3.readnews.com!news-xxxfer.readnews.com!news-out.readnews.com!postnews3.readnews.com!not-for-mail Date: Thu, 30 Oct 2008 07:15:21 -0400 From: "Peter C. Chapin" User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Interesting performance quirk. References: <4903c066$0$28676$4d3efbfe@news.sover.net> <87y707i29v.fsf@mid.deneb.enyo.de> In-Reply-To: <87y707i29v.fsf@mid.deneb.enyo.de> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <49099749$0$5760$4d3efbfe@news.sover.net> Organization: SoVerNet (sover.net) NNTP-Posting-Host: f3a909d3.news.sover.net X-Trace: DXC=ccFoh\dl=nI2@mA_I0]WTDK6_LM2JZB_CKYP;F X-Complaints-To: abuse@sover.net Xref: g2news1.google.com comp.lang.ada:2528 Date: 2008-10-30T07:15:21-04:00 List-Id: Florian Weimer wrote: > Is memory allocation or finalization involved in an inner loop? > It might also help to compare -gnatdg output or assembly (-S). No, the inner loop is pretty much plain computation. The array over which I work is dynamically allocated, however. So I suppose the Ada version is doing checks to make sure the access value that points at the array isn't null, whereas the C version is probably not doing that. I'm not sure how much of an effect those null checks would have, though. Blowfish's uses 16 "rounds" on each block so depending on where the checks are done they could be lost in the overhead of the algorithm... or not. As Martin said in another post, I understand that by making some adjustments to the code one can often coax the compiler to skip checks that are actually unnecessary without violating the semantics of Ada. I will definitely have to look into that. Thanks for your suggests above for getting further information. I would definitely like to understand *why* the code is slow before spending too much time try to fix it. I've optimized code before (not Ada code) and I know that just guessing about the problem often doesn't work well. Peter