From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,35ed85a9d92a025 X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Ada-95 for numerics? Date: 1996/04/03 Message-ID: #1/1 X-Deja-AN: 145620773 references: <199604021629.SAA00724@email.enst.fr> organization: The Mitre Corp., Bedford, MA. newsgroups: comp.lang.ada Date: 1996-04-03T00:00:00+00:00 List-Id: In article <199604021629.SAA00724@email.enst.fr> Jean-Pierre Rosen 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...