comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Not good for Ada endorsement
Date: Thu, 8 Jul 2021 10:42:40 +0200	[thread overview]
Message-ID: <sc6dpv$7qo$1@gioia.aioe.org> (raw)
In-Reply-To: sc6cgh$9vu$1@dont-email.me

On 2021-07-08 10:20, Jeffrey R. Carter wrote:
> 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.

Exactly, this is what is wrong with such contests. The solution is 
non-scalable giving advantage to low-level languages like C. Scalability 
and readability has the price that hobby-sized instances work poorly.

P.S. I would also suggest ensuring the Boolean array not packed. If not 
with compiler switches and pragmas then by declaring a custom Boolean 
1,2,4,8 bytes long depending on the target architecture. It is not a 
fair play, guys!


-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  reply	other threads:[~2021-07-08  8:42 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 14:21 Not good for Ada endorsement Richard Iswara
2021-07-07 15:06 ` Luke A. Guest
2021-07-07 15:19   ` Doctor Who
2021-07-07 19:21     ` Simon Wright
2021-07-07 19:49       ` Doctor Who
2021-07-07 20:39         ` Luke A. Guest
2021-07-08  3:46         ` Richard Iswara
2021-07-08  8:20           ` Jeffrey R. Carter
2021-07-08  8:42             ` Dmitry A. Kazakov [this message]
2021-07-08  8:52             ` Luke A. Guest
2021-07-08 10:42             ` Jeffrey R. Carter
2021-07-08 10:51               ` Luke A. Guest
2021-07-08 11:12                 ` Jeffrey R. Carter
2021-07-08 17:37                   ` Luke A. Guest
2021-07-08 17:43                     ` Luke A. Guest
2021-07-08 19:16                       ` Luke A. Guest
2021-07-08 19:16                     ` Luke A. Guest
2021-07-09  2:47                       ` Richard Iswara
2021-07-09  8:10                     ` Paul Rubin
2021-07-09  8:24                       ` Egil H H
2021-07-09  8:33                     ` Egil H H
2021-07-09  9:16                       ` Jeffrey R. Carter
2021-07-09  9:21                         ` Jeffrey R. Carter
2021-07-15 15:13                           ` Lucretia
2021-07-15 15:56                             ` Jeffrey R. Carter
2021-07-15 16:29                               ` Anh Vo
2021-07-15 17:30                                 ` Lucretia
2021-07-16 16:27                                   ` Simon Wright
2021-07-16 16:28                                   ` Simon Wright
2021-07-23 17:55                                     ` Luke A. Guest
2021-07-23 17:04                                 ` Anh Vo
2021-07-23 17:12                                   ` Luke A. Guest
2021-07-15 16:29                               ` Lucretia
2021-07-15 16:49                                 ` Dmitry A. Kazakov
2021-07-15 21:08                                 ` Jeffrey R. Carter
2021-07-11 15:54 ` Dennis Lee Bieber
2021-07-18 23:03 ` Mace Ayres
2021-07-19  1:00   ` Paul Rubin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox