comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Ada-95 for numerics?
Date: 1996/04/03
Date: 1996-04-03T00:00:00+00:00	[thread overview]
Message-ID: <EACHUS.96Apr3112853@spectre.mitre.org> (raw)
In-Reply-To: 199604021629.SAA00724@email.enst.fr

In article <199604021629.SAA00724@email.enst.fr> Jean-Pierre Rosen <rosen@EMAIL.ENST.FR> writes:

  > If the compiler is not very clever, generated code will be the
  > same as with what you wrote. But it is much easier for the
  > compiler to recognize that a simple "move byte string" instruction
  > is enough to do the trick.

   Or on a lot of modern hardware, the compiler can often make use of
hardware or OS features for zeroing memory.  For extremely large
arrays that have to be initialized to zero, it is better to allocate
them on the heap on certain platforms as a heap allocation always
returns zeroed memory.  (The OS can do this for you faster in many
cases because it "knows" that the data is going to be overwritten, so
it never reads it, in some cases disabling the cache to do so.)

   Incidently this "trick" is more than just a parlor trick.  I once
used hardware calls that blanked a memory bank to run an O(N**2 log N)
algorithm in O(N log N) time.  Clearing a 128K memory bank to zero out
a O(4K) array may seem wasteful, but boy did it help the performance.

--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




  reply	other threads:[~1996-04-03  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-02  0:00 Ada-95 for numerics? Jean-Pierre Rosen
1996-04-03  0:00 ` Robert I. Eachus [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-04-05  0:00  Dr J Parker
1996-04-02  0:00 Joerg Rodemann
1996-04-02  0:00 ` Robert Dewar
1996-04-01  0:00 Joerg Rodemann
1996-04-01  0:00 ` Robert Dewar
1996-04-02  0:00   ` michael
1996-04-01  0:00 ` Ted Dennison
1996-04-01  0:00   ` Robert Dewar
1996-04-02  0:00 ` Dale Stanbrough
1996-04-03  0:00 ` Robert I. Eachus
replies disabled

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