comp.lang.ada
 help / color / mirror / Atom feed
From: "Jean-Pierre Rosen" <rosen@adalog.fr>
Subject: Re: C/Ada performance comparison
Date: Thu, 5 Jul 2001 16:49:37 +0200
Date: 2001-07-05T16:49:37+02:00	[thread overview]
Message-ID: <9i1urp$g98$1@s1.read.news.oleane.net> (raw)
In-Reply-To: 9i1qig$36o$1@nh.pace.co.uk

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]


"Marin David Condic" <marin.condic.auntie.spam@pacemicro.com> a �crit dans le message news: 9i1qig$36o$1@nh.pace.co.uk...
> In general, I'd agree. However, there might be cases where this is not true.
> If, for example, I'm doing a lot of computations in a tight loop over a
> really large number of iterations, the constraint checking of numeric values
> might add a considerable overhead. Imagine you write X := X + 1 ; That ought
> to degenerate to a single add instruction with descent optimization, but if
> you have to do the computation then check that you have not exceeded the
> range of X's subtype and possibly do something to raise Constraint_Error,
> that single instruction can expand to quite a few. Do that in a tight loop a
> million times or so and you'll see some significant changes in performance.
>
Sure. But don't forget that you can put a pragma suppress in a declare block, so that it will affect only that sequence which is
truly critical, and not the 99% of the remaining code.

Too often, people think that checks are "on" or "off" for the whole program (which happens if you do that with a compiler option).
Ada provides finer granularity.

--
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr





      reply	other threads:[~2001-07-05 14:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-29 14:19 C/Ada performance comparison Tomas Hlavaty
2001-07-03 16:20 ` Marin David Condic
2001-07-03 19:09 ` tmoran
2001-07-03 22:09 ` Jeffrey Carter
2001-07-04 17:27   ` Colin Paul Gloster
2001-07-04 17:43     ` Samuel Tardieu
2001-07-05  7:12       ` Colin Paul Gloster
2001-07-05 11:55         ` Larry Kilgallen
2001-07-05 21:46         ` Robert Dewar
2001-07-05 13:37   ` Marin David Condic
2001-07-05 14:49     ` Jean-Pierre Rosen [this message]
replies disabled

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