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,2a687662f09731bb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g43g2000cwa.googlegroups.com!not-for-mail From: "jimmaureenrogers@worldnet.att.net" Newsgroups: comp.lang.ada Subject: Re: Request for comments on simple Ada program Date: 16 Nov 2005 06:46:03 -0800 Organization: http://groups.google.com Message-ID: <1132152363.037823.129410@g43g2000cwa.googlegroups.com> References: <1132079385.862345.261290@g49g2000cwa.googlegroups.com> NNTP-Posting-Host: 209.194.156.4 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1132152368 11563 127.0.0.1 (16 Nov 2005 14:46:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 16 Nov 2005 14:46:08 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g43g2000cwa.googlegroups.com; posting-host=209.194.156.4; posting-account=SqOfxAwAAAAkL81YAPGH1JdBwpUXw9ZG Xref: g2news1.google.com comp.lang.ada:6432 Date: 2005-11-16T06:46:03-08:00 List-Id: tmoran@acm.org wrote: > >using a packed array of boolean. The space savings from packing > >the array will frequently result in an array that will be kept in the > >CPU cache. > > > >Even though it is less efficient to access individual bits, the program > >execution speed, by my measurements, will increase by a factor of > >approximately 3. The execution advantage is explained by the lack > >of I/O overhead to off-cpu memory. > I'm surprised. What size cache do you have and what value of Upper > did you use for timing? My timings were done on a similar program which can be found at http://shootout.alioth.debian.org/benchmark.php?test=nsieve&lang=gnat&id=0 My home system has an AMD 64 3400+ processor with 512 Mb L2 cache. I ran my tests using Win XP Service Pack 1. The program takes input from the command line and calculates 3 different values of Upper. It simply reports the number of primes calculated during the run. The output for a command line value of '9' is: PROGRAM OUTPUT ============== Primes up to 5120000 356244 Primes up to 2560000 187134 Primes up to 1280000 98610 Jim Rogers