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, 15 Jul 2021 18:49:07 +0200	[thread overview]
Message-ID: <scpou0$17gh$1@gioia.aioe.org> (raw)
In-Reply-To: 59c3fb8e-6866-4ea9-a1a2-21fdff252095n@googlegroups.com

On 2021-07-15 18:29, Lucretia wrote:
> On Thursday, 15 July 2021 at 16:56:40 UTC+1, Jeffrey R. Carter wrote:
>> On 7/15/21 5:13 PM, Lucretia wrote:
>>>
>>> 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.
>> So you have an array of a modular type, calculate an index and bit within it,
>> mask out that bit, and compare it to zero? I would have thought an unpacked
>> array of Boolean would be fastest.
> 
> Doesn't seem to be.

Unlikely unless compiled into machine-specific instructions. You should 
inspect the code.

> Also, the guy is using the packed bit as the final test of all the languages.
> 
>> A packed array of Boolean requires all the operations above, plus shifting the
>> bit to the LSB and treating the result as a Boolean, so it may not be that
> 
> Don't need to shift to the LSB, only need to shift the 1 to the bit location you want to test, invert and then check against 0.

Usually masks are either tabulated in a look-up table or are constants 
in a case choice.

>> surprising that it's slower.
> 
> I know. I  would've thought the compiler would've handled the packed array as a special case and optimised as much as possible there.

It is still unlikely to be faster than all arrays. You should probably 
try to use different element types and inspect the code.

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

  reply	other threads:[~2021-07-15 16:49 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
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 [this message]
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