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=-2.9 required=3.0 tests=BAYES_00,NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Not good for Ada endorsement Date: Thu, 8 Jul 2021 10:20:31 +0200 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <5a1cegtfm5ibqej3ldebpc4g99ujniqt9u@4ax.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 8 Jul 2021 08:20:34 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="0384baa1f4ca43093e9cff3bed7731f1"; logging-data="10238"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qf/xzxAACrL7Nt53dZ9lr1o1YLD0OO6M=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 Cancel-Lock: sha1:3RHZWey4yXVUzChagrd9E9Vx+mU= In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:62350 List-Id: On 7/8/21 5:46 AM, Richard Iswara wrote: > Indirectly it is a comparison of implementation and tools benchmarking. Looking at the gpr file, there is no compile switch used, not even an "-o2" switch. Compiling with -gnatp -O3 would undoubtedly speed it up (suppressing checks is justified since execution with checks active shows that no checks fail). Looking casually at the code, the map could be replaced by a constant, as Sieve_Size is hard coded to 1,000,000, and the filling of the map is included in the timing. The calculation of the square root of 1,000,000 could be replaced by a constant. The array of Boolean could be constrained to 3 .. Sieve_Size. The function that simply returns (others => True) could be replaced by the aggregate, though optimization will probably do that. Long_Long_Integer could be replaced by a type with range 0 .. 2 ** 31 - 1, though I don't know if that would have any effect. The first inner loop in the sieve algorithm could be eliminated, in which case the initialization of Num could also be removed. -- Jeff Carter "My legs are gray, my ears are gnarled, my eyes are old and bent." Monty Python's Life of Brian 81