comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Creem <jeff@thecreems.com>
Subject: Re: GNAT compiler switches and optimization
Date: Fri, 20 Oct 2006 19:52:54 -0400
Date: 2006-10-20T19:52:54-04:00	[thread overview]
Message-ID: <434o04-7g7.ln1@newserver.thecreems.com> (raw)
In-Reply-To: <9Qb_g.111857$aJ.65708@attbi_s21>

Jeffrey R. Carter wrote:
> tkrauss wrote:
> 
>> I'm a bit stuck trying to figure out how to coax more performance
>> out of some Ada code.  I suspect there is something simple (like
>> compiler switches) but I'm missing it.  As an example I'm using
>> a simple matrix multiply and comparing it to similar code in
>> Fortran.  Unfortunately the Ada code takes 3-4 times as long.
> 
> 
> 1st, make sure you're timing the same thing. How does Ada matrix 
> multiplication compare to FORTRAN? You don't know, because you're also 
> timing the random number generators and I/O. Ada.Text_IO, especially, is 
> quite heavy-weight compared to other languages.
> 
> Here's my version of your program:
> 

Note, I am the first one to jump to the defense of "Ada" in general but 
in this case, GNAT just plain sucks compared to GNU FORTRAN as it does a 
poor job on (at least) the inner loop (verified by looking at the output 
  assembly)

Jeff's (the other jeff :) modified version looks a little cleaner and 
actually runs faster (than even old "fixed version" that did not time 
the IO and made sure to just time the matrix multiply in both versions) 
but it does not time the zeroing of the elements of C which would be 
required if this were a real matrix multiply routine and not some test 
driver.

However, even having said that, this not really equivilent version runs 
about 2x slower than the FORTRAN (with the same version of GCC)

I don't see any meaningful excuse for why GNAT should be slower in this 
case but it clearly is.

I tried looking at the tree dump generated by the front ends prior to 
going to the optimizer step (not something I have a lot of experience 
at) . One thing is clear is the trees generated by GNAT is quite a bit 
uglier and more verbose so it is not surprising that the optimizer is 
unable to fully clean things up resulting in the explosion of 
instructions at the assembly level.







  reply	other threads:[~2006-10-20 23:52 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-20 10:47 GNAT compiler switches and optimization tkrauss
2006-10-20 11:04 ` Duncan Sands
2006-10-21 10:45   ` Stephen Leake
2006-10-20 11:42 ` Duncan Sands
2006-10-20 15:41   ` Martin Krischik
2006-10-20 12:09 ` Samuel Tardieu
2006-10-20 12:18   ` Samuel Tardieu
2006-10-20 12:12 ` Gautier
2006-10-20 12:35 ` Dmitry A. Kazakov
2006-10-20 15:53   ` Martin Krischik
2006-10-20 12:52 ` Gautier
2006-10-20 13:27 ` claude.simon
2006-10-20 15:38 ` Robert A Duff
2006-10-20 19:32   ` Gautier
2006-10-20 15:56 ` Jeffrey Creem
2006-10-20 16:30 ` Martin Krischik
2006-10-20 19:51 ` Gautier
2006-10-20 22:11 ` Jeffrey R. Carter
2006-10-20 23:52   ` Jeffrey Creem [this message]
2006-10-21  7:37     ` Gautier
2006-10-21 16:35       ` Jeffrey Creem
2006-10-21 17:04         ` Pascal Obry
2006-10-21 21:22           ` Jeffrey Creem
2006-10-22  3:03             ` Jeffrey Creem
2006-10-22  7:39               ` Jeffrey R. Carter
2006-10-22 11:48                 ` tkrauss
2006-10-22 18:02                   ` Georg Bauhaus
2006-10-22 18:24                     ` Jeffrey Creem
2006-10-23  0:10                       ` Georg Bauhaus
2006-10-22 20:20                   ` Jeffrey R. Carter
2006-10-22 12:31                 ` Gautier
2006-10-22 20:26                   ` Jeffrey R. Carter
2006-10-22 21:22                     ` Gautier
2006-10-22 18:01                 ` tmoran
2006-10-22 20:54                   ` Jeffrey R. Carter
2006-10-22 13:50               ` Alinabi
2006-10-22 15:41                 ` Jeffrey Creem
2006-10-23  0:02                   ` Alinabi
2006-10-23  5:28                     ` Gautier
2006-10-23 16:32                       ` Alinabi
2006-10-22 15:57               ` Jeffrey Creem
2006-10-22 19:32                 ` Damien Carbonne
2006-10-22 20:00                   ` Gautier
2006-10-22 20:51                     ` Damien Carbonne
2006-10-23  2:15                       ` Jeffrey Creem
2006-10-23  2:29                         ` Jeffrey R. Carter
2006-10-23  1:31                   ` Jeffrey Creem
2006-10-23  3:10                     ` Jeffrey Creem
2006-10-23  7:31                       ` Jeffrey R. Carter
2006-10-23 11:55                         ` Jeffrey Creem
2006-10-23 19:52                           ` Wiljan Derks
2006-10-23 20:25                             ` Jeffrey R. Carter
2006-10-24  9:52                             ` Dr. Adrian Wrigley
2006-10-24 11:50                               ` Jeffrey Creem
2006-10-24 16:24                                 ` Jeffrey R. Carter
2006-10-25  3:50                                   ` Jeffrey Creem
2006-10-25 15:32                                     ` claude.simon
2006-10-24 19:21                               ` Wiljan Derks
2006-10-23 12:33                   ` Warner BRUNS
2006-10-23 12:40                   ` Warner BRUNS
2006-10-23 13:52                     ` Georg Bauhaus
2006-10-23 17:11                       ` Warner BRUNS
2006-10-23 17:57                         ` Dr. Adrian Wrigley
2006-10-23 15:02                     ` Robert A Duff
2006-10-23 20:22                       ` Jeffrey R. Carter
2006-10-21 18:28         ` tmoran
2006-10-23  6:28       ` Martin Krischik
2006-10-21 12:39 ` Dr. Adrian Wrigley
replies disabled

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