Re: Request for comments on simple Ada program



tmoran@xxxxxxx 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

.



Relevant Pages

  • Re: greatest multiple algorithm
    ... array stores found primes ... modulo with found primes in array to find new primes ... consumes large amounts of memory ... That doesn't sound like a sieve, ...
    (comp.lang.asm.x86)
  • Re: [Algorithm] Sum of Primes < 1000000
    ... Note also skipping the inner loop for composite values of i. ... The number of primes is O) from what I've seen of primes, which is Osince the log of the square root is simply half the log and the half disappears into the constant factor. ... The inner loop does one imul, three iadds (one's actually the subtract in the loop test and one computes the array index), one icmp, and one boolean assignment. ...
    (comp.lang.java.programmer)
  • Re: Vernons Prime Sieve
    ... // your primesarray is not big enough. ... // the primes that fit in 16 bits can be used to find ... > (i.e. it takes about twice as long to do test twice as ... would like hexadecimal output, then %X is the way to go. ...
    (sci.math)
  • Re: More on triangle numbers and primes!
    ... > want to extract or the limit of the array or file you have for storage. ... > spots by identifying the location as a prime or if an ... > for listing out the primes. ... Hmm...Do you have a pattern that runs in accelerating numerical value steps ...
    (sci.math)
  • SUMMARY: Help! Self Induced 6540 Catastrophe
    ... firmware command for a StorageTek 6540 to revert a 'reset array' ... rather than manually recreating the LUNs. ... I've finally caught up after losing everything on this array. ...
    (SunManagers)

Loading