Deutsch English Français Italiano |
<va2cfr$3e9l1$1@raubtier-asyl.eternal-september.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail From: Bonita Montero <Bonita.Montero@gmail.com> Newsgroups: comp.lang.c++ Subject: Re: OT: Re: Sieve of Erastosthenes optimized to the max Date: Tue, 20 Aug 2024 17:24:48 +0200 Organization: A noiseless patient Spider Lines: 36 Message-ID: <va2cfr$3e9l1$1@raubtier-asyl.eternal-september.org> References: <ul41d4$2koct$1@raubtier-asyl.eternal-september.org> <utoh9d$6lrr$1@raubtier-asyl.eternal-september.org> <utq0ag$hvrl$3@dont-email.me> <utq0os$ibqn$1@raubtier-asyl.eternal-september.org> <utq11p$icmm$1@dont-email.me> <v25c87$1ld9m$1@dont-email.me> <86r0duwqgg.fsf@linuxsc.com> <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> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 20 Aug 2024 17:24:43 +0200 (CEST) Injection-Info: raubtier-asyl.eternal-september.org; posting-host="61b6f8d4fcabecbabc54f833d37a7549"; logging-data="3614369"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18lIFzZDS5MU5JKjT3SOg8ml0TGKk4ruL4=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:oTYyvFuMh0RCiLDrhmZQKKzC7wA= Content-Language: de-DE In-Reply-To: <va2ca2$3e60e$1@raubtier-asyl.eternal-september.org> Bytes: 3445 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. With the three you save a sixth of memory, with >>> the five you save a 15-th and at the end you get about 20% less >>> storage (1 / (2 * 3) + 1 / (2 * 3 * 5) + 1 / (2 * 3 * 5 * 7) ...) >>> for a lot of computation. That's the point where I dropped this >>> idea and I think this extra computation is higher than the time >>> for the saved memory loads. >>> >> It's not just storage you save, it's also computation. >> >> That program I published up-thread is almost as fast as yours - within >> 10% of the elapsed time - while only using a single core. The amount >> of CPU used is much lower. >> >> Andy > > On my AMD 7990X all primes up to 2 ^ 32 are calculated with my code > with a 65W-setting of the CPU in 0.168s. The total CPU-time is 3.688s. > With your code all primes up to 2 ^ 32 take nearly exactly four seconds > with a single thread. So the overall computation time with my algorithm > is about seconds less. And if I run my code with a single core: C:\Users\Boni\Documents\Source\bitmapSieve>timep "x64\Release-clang++\bitmapSieve.exe" 0x100000000 "" 1 real 1.795s user 1.766s sys 0.000s cylces 8.011.804.500 Thats less than half the computation time.