[TriLUG] Shopping for new laptop...
Steve Litt
slitt at troubleshooters.com
Thu Jul 12 12:42:32 EDT 2007
On Thursday 12 July 2007 09:54, Warren Myers wrote:
>
> On 7/12/07, Steve Litt <slitt at troubleshooters.com> wrote:
> > On Thursday 12 July 2007 09:24, Warren Myers wrote:
> > > true - and with 4800 and 5400 rpm drives still fairly standard (espy on
> > > cheap laptops), drive access will *always* be the slowdown.
> >
> > Tell that to my prime number generator :-)
> of course - it's swapping to disk :P
Not for the first hundred million or so. It basically lays out an array of
bits (not bytes) in memory, and checks off each one whose subscript is a
multiple of a smaller number. So if I have 1.5GB of RAM, and let's say 1GB is
available, I can test numbers 0 to 8billion without swapping.
I have another version that pages ranges in and out, enabling it to find
billions of primes. Pages are stored on disk, but the disk is not the
bottleneck by any stretch of the imagination.
You can see these and other algorithms here:
http://www.troubleshooters.com/codecorn/primenumbers/primenumbers.htm
SteveT
More information about the TriLUG
mailing list