From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_05,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:ac8:41d2:: with SMTP id o18mr4182000qtm.10.1626361986301; Thu, 15 Jul 2021 08:13:06 -0700 (PDT) X-Received: by 2002:a25:6b0c:: with SMTP id g12mr6257538ybc.303.1626361986099; Thu, 15 Jul 2021 08:13:06 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.uzoreto.com!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 15 Jul 2021 08:13:05 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=86.28.147.129; posting-account=L2-UcQkAAAAfd_BqbeNHs3XeM0jTXloS NNTP-Posting-Host: 86.28.147.129 References: <5a1cegtfm5ibqej3ldebpc4g99ujniqt9u@4ax.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <0e6ee3e9-baad-47b3-872b-90ec6c735920n@googlegroups.com> Subject: Re: Not good for Ada endorsement From: Lucretia Injection-Date: Thu, 15 Jul 2021 15:13:06 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:62390 List-Id: On Friday, 9 July 2021 at 10:21:05 UTC+1, Jeffrey R. Carter wrote: > On 7/9/21 11:16 AM, Jeffrey R. Carter wrote: > >> if Number mod 2 /= 0 and then Sieve.Bits(Index_Type(Number)) then > >> > >> and then incrementing Number by 1. > > > > Since both operands are positive, mod and rem give the same results, and rem is > > usually a bit faster. It's normally not an issue, but in this case it's done > > billions of times, so it might make a difference. > Note also that short-circuit forms (and then) require disabling processor-level > optimizations and may have a negative effect on execution time when used > unnecessarily. You don't need those as the algorithm always starts at 3 and increments by 2. I managed to get just under 4000 passes with a 1 bit array, but not using Ada's packed array. That's actually the slowest method, strangely.