Sujet : Re: Sieve of Erastosthenes optimized to the max
De : tr.17687 (at) *nospam* z991.linuxsc.com (Tim Rentsch)
Groupes : comp.lang.c++Date : 22. May 2024, 04:06:07
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <86r0duwqgg.fsf@linuxsc.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Vir Campestris <
vir.campestris@invalid.invalid> writes:
I've been playing with this. Has it really been this long? I
ought to have more time than this... [...]
>
I missed Tim's Mod 30 trick, and that might well help. But I
think I'm bored with this. It would save a lot of memory, but
the extra computation might make it slower.
Two comments. Using the mod 30 encoding can be speed competitive
with simpler encodings. The second comment is, it isn't just
that less memory is used, but that more primes can be found.
Bonita brags about how fast some code is, but it's an apples
and oranges comparison - that code doesn't do the job because
it runs into a memory limit way sooner than using a mod 30
encoding, and trying to run past that limit would make the
code R E A L L Y S L O W.
Maybe I'll try one day ;)
I hope you do. If you have some difficulty seeing how to
avoid the seeming speed penalties, feel free to ask, I am
happy to help.