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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bc4137777a63bff X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!border1.nntp.dca.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 29 Jul 2005 20:41:29 -0500 From: "Steve" Newsgroups: comp.lang.ada References: <1122305318.728942.304120@f14g2000cwb.googlegroups.com> <2OudnZo-iL1aN3jfRVn-iQ@comcast.com> <1122475184.849564.159870@g44g2000cwa.googlegroups.com> <1122547648.069514.63520@g14g2000cwa.googlegroups.com> <87ll3qwzk3.fsf@tiscali.be> Subject: Re: Help needed for ada package Date: Fri, 29 Jul 2005 18:44:07 -0700 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Message-ID: NNTP-Posting-Host: 24.22.63.157 X-Trace: sv3-y611iAFs9w/AdT2UUaPCweiQe2WLsCu2z+75rY6+Bw14k6H2cESenrWY71/ziBPUIwj0D7/gYj5k91X!cxVD7q3n028chkCWM0ko5FaaZJrPE2vaj0Bdj9oJaFABg0cgUlmeEmPIlVfN4JfspTaEZTZFk04= X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:3856 Date: 2005-07-29T18:44:07-07:00 List-Id: "Dennis Lee Bieber" wrote in message news:uaaje1d0l4tp1kjs18mkrgfmbkcir308bt@4ax.com... > On Thu, 28 Jul 2005 20:33:32 +0200, Ludovic Brenta > declaimed the following in comp.lang.ada: > > >> >> Since the type ID is discrete, why not just use that as the array index >> type? >> > That's the approach I took, though some things aren't quite as > clean (I used explicit ranges... should have tried compiling with just > the type). >> Of course, the above solution is outrageously inefficient, both >> memory- and CPU-wise. Optimisations are left as an exercise to the >> reader. > > Tell me about it -- for the 1000000 population, I estimated over > 100GB needed for the association matrix alone, even packing 1-bit > booleans. I then did version 2, using "Steve's" suggestion of encoding > the group identifier into the population data itself... associate() went > from two lines to a page, but half the declarations disappear. > > I will not be posting that version as it is too close to being > directly usable (I didn't write a test suite, so couldn't run it, but it > did compile cleanly). > Perhaps I'm a little naive, but I really don't understand why you need to keep any more than: type Persson is record Citizen_Id : ID; Badness : Rating; Group_Id : Natural; end record; type Population is array( 1 .. 1_000_000) of Person; Society : Population; Next_In : Positive; -- Add new elements here Next_Out : Positive; -- Retrieve next from current group here Baddest : Positive; -- Index to baddest entry Current_Group_Id : Natural; You do wind up scanning the list to do just about anything, but speed was not a requirement. Steve (The Duck) [snip] > > > -- > > ============================================================== < > > wlfraed@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > > wulfraed@dm.net | Bestiaria Support Staff < > > ============================================================== < > > Home Page: < > > Overflow Page: <