comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Use aggregates (Was: Allocation question)
Date: Tue, 12 May 2009 13:07:25 +0200
Date: 2009-05-12T13:07:25+02:00	[thread overview]
Message-ID: <4a09586d$0$30224$9b4e6d93@newsspool1.arcor-online.net> (raw)
In-Reply-To: <4hji05lus782p2r186n8v51t1tpv3tbm0l@4ax.com>

Brian Drummond schrieb:

> If anything gives Ada the reputation for inefficiency and bloat, it's that sort
> of missed opportunity, and not the language itself.

(Did you try this with C99's variable length arrays?)

> There is no fundamental reason why the compiler can't do as good a job as I can
> at unrolling that into loops. And unfortunately, you have thrown away half the
> point of using Ada, if you have to write C in Ada to match the performance of C.

GNAT does seem to emit loop instructions for the following
input.  I get a REPZ in the assembly listing.  What do you get?

package A is

   pragma Pure;

   subtype Intensity is Natural range 0 .. 255;
   type Index is range 1 .. 100;
   type List is array(Index) of Intensity;

   Zero: constant List := List'(others => 0);

   function Is_Zero(Item: List) return Boolean;

end A;

package body A is

   function Is_Zero(Item: List) return Boolean is
   begin
      return Item = Zero;
   end Is_Zero;

end A;



  reply	other threads:[~2009-05-12 11:07 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-11 10:23 Allocation question Olivier Scalbert
2009-05-11 10:38 ` Georg Bauhaus
2009-05-11 10:40 ` Ludovic Brenta
2009-05-11 12:14   ` Olivier Scalbert
2009-05-11 12:18     ` Ludovic Brenta
2009-05-11 13:01       ` Olivier Scalbert
2009-05-11 12:26   ` Jacob Sparre Andersen
2009-05-11 13:27     ` Ludovic Brenta
2009-05-11 10:51 ` Use aggregates (Was: Allocation question) Jacob Sparre Andersen
2009-05-11 11:46   ` Olivier Scalbert
2009-05-11 12:16   ` Ludovic Brenta
2009-05-11 21:26     ` sjw
2009-05-12  5:58       ` GNAT, aggregates and efficiency (Was: Use aggregates) Jacob Sparre Andersen
2009-05-12 18:57         ` sjw
2009-05-12  7:47     ` Use aggregates (Was: Allocation question) Martin
2009-05-12 10:24       ` Brian Drummond
2009-05-12 11:07         ` Georg Bauhaus [this message]
2009-05-12 11:14           ` Georg Bauhaus
2009-05-12 21:18       ` Randy Brukardt
2009-05-13 16:38         ` Martin
2009-05-13 20:38           ` Randy Brukardt
2009-05-14 10:48             ` Martin
2009-05-12  9:13   ` Emacs Stephen Leake
2009-05-12  9:38     ` Emacs Ludovic Brenta
2009-05-12  9:46     ` Emacs Olivier Scalbert
2009-05-11 10:57 ` Allocation question Philipp Riegger
2009-05-11 12:18   ` Georg Bauhaus
2009-05-11 12:36     ` Philipp Riegger
2009-05-11 23:32 ` Brian Drummond
2009-05-12  1:09 ` tmoran
replies disabled

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