Deutsch English Français Italiano |
<86v7zn3xwk.fsf@linuxsc.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch <tr.17687@z991.linuxsc.com> Newsgroups: comp.lang.c++ Subject: Re: OT: Re: Sieve of Erastosthenes optimized to the max Date: Mon, 26 Aug 2024 12:08:11 -0700 Organization: A noiseless patient Spider Lines: 32 Message-ID: <86v7zn3xwk.fsf@linuxsc.com> References: <ul41d4$2koct$1@raubtier-asyl.eternal-september.org> <v39o3l$1lvju$1@dont-email.me> <86o78mpnlf.fsf@linuxsc.com> <v3fv2u$2ursd$1@dont-email.me> <86ttibod7n.fsf@linuxsc.com> <86h6eaoi2r.fsf@linuxsc.com> <v4sool$1grge$1@dont-email.me> <867celixcw.fsf@linuxsc.com> <v5sg9s$mat4$1@dont-email.me> <86zfr0b9hw.fsf@linuxsc.com> <v638ud$25623$1@dont-email.me> <861q3o5do1.fsf@linuxsc.com> <v7tdts$29195$1@dont-email.me> <868qx45v5g.fsf@linuxsc.com> <v9lbns$11alj$1@dont-email.me> <86r0aojx1m.fsf@linuxsc.com> <v9o2kf$1gqv1$1@raubtier-asyl.eternal-september.org> <va09jq$30cvv$1@dont-email.me> <va2ca2$3e60e$1@raubtier-asyl.eternal-september.org> <va2cfr$3e9l1$1@raubtier-asyl.eternal-september.org> <va2hq5$3f1gl$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Mon, 26 Aug 2024 21:08:13 +0200 (CEST) Injection-Info: dont-email.me; posting-host="d6baed66fa18aad174400126e3461865"; logging-data="2720457"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Icjjs1PEloei9m27ZcFzDkXdq0vG2jdw=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:Dn+yt2zGrsnoX4bF3A0byesO8EU= sha1:dmjCujwbAam03UexAIDsTtUL47o= Bytes: 3095 Vir Campestris <vir.campestris@invalid.invalid> writes: > On 20/08/2024 16:24, Bonita Montero wrote: > >> Am 20.08.2024 um 17:21 schrieb Bonita Montero: >> >>> Am 19.08.2024 um 22:23 schrieb Vir Campestris: >>> >>>> On 16/08/2024 18:35, Bonita Montero wrote: >>>> <snip> >>>> >>>>> But basically I don't think it is a good idea to skip numbers >>>>> exept multiples of two. [...] I think this extra computation >>>>> is higher than the time for the saved memory loads. [...] > I'm leaning towards thinking you may have a point on the mod30 > code. There are more operations on the innermost loop with mod30, > although the loop goes around fewer times. It also means that the > store is forced to be byte wide - I find that my original odd-only > code is significantly faster - about 30% - when the store is 64 > bit wide rather than byte. [...] One motivation for choosing a mod30 representation is being able to compute more primes -- almost twice as many. Any machine with 64GB of memory should be able to compute primes up to 1.5 trillion. Even if an odds-only representation runs faster for more limited sizes (and I'm not yet convinced that it does), it doesn't matter if it's faster, because it doesn't do the job. I was computing all 32-bit primes 20 years ago, back when 32-bit machines were a thing. The challenge for today's world is correspondingly higher.