comp.lang.ada
 help / color / mirror / Atom feed
From: Gautier <gautier@fakeaddress.nil>
Subject: Re: GNAT Optimization of Constant Expressions
Date: Thu, 17 May 2007 22:03:26 +0200
Date: 2007-05-17T22:03:26+02:00	[thread overview]
Message-ID: <464cb4cd$1_3@news.bluewin.ch> (raw)
In-Reply-To: <f2gmpv$raj$1@jacob-sparre.dk>

Randy:

[a brilliant dissertation about optimization]
> After all, your original code is written to make a bunch of very expensive
> calls ("Sin(0.5)", for instance) many times. Expecting the compiler to
> remove those calls is asking a lot;

I agree for any function call, but in the special case of functions from 
Generic_Elementary_Functions, it is _not_ asking a lot! A decent compiler 
should perform optimizations around these functions as well as around 
arithmetic operators.

> it is much better to avoid making extra
> calls with appropriate constant declarations. (I'd have that advice for any
> language; why force the optimizer to work hard and possibly fail??)

Obviously, there are compilers where the optimizer is working hard for the 
programmer, and other ones where the programmer has to work hard to make the 
optimizer work!

______________________________________________________________
Gautier         -- http://www.mysunrise.ch/users/gdm/index.htm
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!



  reply	other threads:[~2007-05-17 20:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-16 22:37 GNAT Optimization of Constant Expressions David Smith
2007-05-17  4:50 ` Randy Brukardt
2007-05-17 20:03   ` Gautier [this message]
2007-05-17 20:46     ` Randy Brukardt
2007-05-17 22:49       ` David Smith
2007-05-17 23:38         ` Randy Brukardt
2007-05-18  7:58           ` Dmitry A. Kazakov
2007-05-18 11:27           ` Georg Bauhaus
2007-05-18 17:28             ` Randy Brukardt
2007-05-18 16:25       ` Ray Blaak
2007-05-18 17:40         ` Randy Brukardt
2007-05-18 22:51           ` Adam Beneschan
2007-05-19  2:44             ` Randy Brukardt
2007-05-18  9:05   ` Markus E Leypold
2007-05-18  9:47   ` Florian Weimer
2007-05-18 11:32     ` Duncan Sands
2007-05-18 17:20     ` Randy Brukardt
2007-05-18 17:35       ` Duncan Sands
     [not found]       ` <200705181935.23877.baldrick@free.fr>
2007-05-18 17:49         ` Duncan Sands
2007-05-17  5:30 ` Martin Krischik
2007-05-18  9:56 ` Duncan Sands
2007-05-18 15:39   ` David Smith
2007-05-18 17:08     ` Duncan Sands
     [not found]     ` <200705181908.54920.baldrick@free.fr>
2007-05-18 17:32       ` Duncan Sands
replies disabled

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