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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5ff6e0c3de8331c0 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: sub-optimal code for packed boolean arrays -- bug or inherent limitation Date: Sun, 08 Jul 2007 18:53:11 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1183404856.375083.160890@q69g2000hsb.googlegroups.com> <1183485842.725620.199490@w5g2000hsg.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1183935192 16493 192.74.137.71 (8 Jul 2007 22:53:12 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 8 Jul 2007 22:53:12 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:NacKr7c54lSTlao71OQTRNxvJT4= Xref: g2news1.google.com comp.lang.ada:16431 Date: 2007-07-08T18:53:11-04:00 List-Id: "Jeffrey R. Carter" writes: > You should also be aware that you're sending the compiler conflicting > messages. Packing the array indicates that you want the compiler to > minimize storage, even at the expense of speed,... Well, sort of. Pack means to minimize storage even at the (possible) expense of speed of accessing the components. Speed overall can be improved by packing. For example, speed of copying and comparing the whole packed object, and passing it around as parameters, will typically be improved by packing. And of course using less memory will typically improve cache and paging performance. So on a desktop computer with "plenty" of memory, packing is mainly used to improve speed -- there's no "time/space" tradeoff. A small embedded system might have such tradeoffs. >... while "pragma Optimize > (Time);" indicates that you want to minimize time, even at the expense > of storage. Obtaining speed often requires wasting storage; the fastest ^^^^^ I'd say, "sometimes", nor "often". Usually, wasting storage means wasting time. > implementation might be to not pack the array. I don't know how many of > these you have, but with the large memories on modern machines, you > might be better off with the additional 56 bytes per array. Again, you > won't know for sure until you have a working version you can measure. Measurement is a Good Thing. - Bob