Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: OT: Re: Sieve of Erastosthenes optimized to the max
Date: Fri, 16 Aug 2024 07:48:07 -0700
Organization: A noiseless patient Spider
Lines: 42
Message-ID: <86ikw0le1k.fsf@linuxsc.com>
References: <86r0duwqgg.fsf@linuxsc.com> <86o78mpnlf.fsf@linuxsc.com> <86ttibod7n.fsf@linuxsc.com> <86h6eaoi2r.fsf@linuxsc.com> <867celixcw.fsf@linuxsc.com> <86zfr0b9hw.fsf@linuxsc.com> <861q3o5do1.fsf@linuxsc.com> <868qx45v5g.fsf@linuxsc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Fri, 16 Aug 2024 16:48:11 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7281b2582241b74932977c55e2504530"; logging-data="1557209"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+mJyZoED9OQW0bHEusQeNwDY5Sy4C/wGg="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:20QR7wc9OuD+VJ15bhQZOH1TsoU= sha1:LdxpkzdIcrEWrLyxn+j63BrXKlI=
Xref: csiph.com comp.lang.c++:119815
Vir Campestris writes:
> (replying to two messages at once)
>
> On 10/08/2024 15:07, Tim Rentsch wrote:
>
>>> I suspect the cost of extracting the divided value from the 7
>>> bytes will be prohibitive. You may find it's best to have one
>>> table for the N/30 parts (big entries, word aligned) and another
>>> for the N%30 part (small entries, byte aligned). BICBW.
>>
>> Two tables, absolutely. What does BICBW stand for?
>
> But I Could Be Wrong. I thought that one was fairly well known.
Ah. No wonder I didn't know it. ;)
> On 11/08/2024 08:00, Tim Rentsch wrote:
>
>> Note that the %30 tables can be shared. There are 8 of them, one
>> for each of the eight residues mod 30 of the original prime.
>
> I started coding that up. Then it occurred to me that there wasn't
> going to be much saving by storing a pointer (8 bytes on my machine)
> to the correct 8-byte long table. I suppose I could store a byte array
> index instead, but I've gone off in other directions.
Right, I was meaning keeping track of the index, not a pointer.
> You've picked up my cache management tweak.
It's an interesting idea, although I'm not sure how well it
integrates with what I've done.
> I'll read through your code. But it might not be today. We've got the
> hottest day of the year here, and I don't have aircon in my garden
> office. In winter the computer and me are enough to keep it warm, but
> right now it's getting warmer by the minute.
My sympathies. I too find it hard to work when it's too hot.
I see you have started looking at my code... I'll take a look.