Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Vir Campestris Newsgroups: comp.lang.c++ Subject: Re: OT: Re: Sieve of Erastosthenes optimized to the max Date: Mon, 12 Aug 2024 15:32:33 +0100 Organization: A noiseless patient Spider Lines: 28 Message-ID: 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=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 12 Aug 2024 16:32:33 +0200 (CEST) Injection-Info: dont-email.me; posting-host="ba62fd7f861f01396a4b4b18eeb110c0"; logging-data="3505696"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tCZ8mosOnuEcAHFdQciw30zWa0+Rw+wg=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:DMkn8+lvl1NfmL5Kd+pVB7M30z8= Content-Language: en-GB In-Reply-To: <868qx45v5g.fsf@linuxsc.com> Bytes: 3026 (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. 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. You've picked up my cache management tweak. 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. Andy