Some comments relating to ICFP contest Andre van Tonder (25 Jul 2006 20:25 UTC)
Re: Some comments relating to ICFP contest Alex Shinn (26 Jul 2006 02:04 UTC)
Re: Some comments relating to ICFP contest Michael Sperber (26 Jul 2006 05:03 UTC)
Re: Some comments relating to ICFP contest Alan Watson (26 Jul 2006 08:40 UTC)
Re: Some comments relating to ICFP contest Michael Sperber (26 Jul 2006 09:02 UTC)
Re: Some comments relating to ICFP contest bear (04 Sep 2006 17:31 UTC)
Re: Some comments relating to ICFP contest Andre van Tonder (26 Jul 2006 15:12 UTC)
Re: Some comments relating to ICFP contest Michael Sperber (26 Jul 2006 15:35 UTC)
Re: Some comments relating to ICFP contest Andre van Tonder (26 Jul 2006 16:23 UTC)
Re: Some comments relating to ICFP contest Michael Sperber (27 Jul 2006 15:51 UTC)

Re: Some comments relating to ICFP contest Andre van Tonder 26 Jul 2006 16:22 UTC

On Wed, 26 Jul 2006, Michael Sperber wrote:

> Andre van Tonder <xxxxxx@now.het.brown.edu> writes:
>
>> Conceded.  But the context of my comment was efficiency.  How likely
>> is it that implementations will compile the expression (exact-and (* x
>> y) #xFFFFFFFF) to the single machine instruction available on many
>> architectures?
>
> I would think it's about as likely as a "32-bit type" doing the same
> thing.  On a 32-bit architecture, if your values are tagged, ...

I had backed off from the initial suggestion of separate types, instead
suggesting only additional procedures on the existing exact integer type.  Even
if values are tagged, it seems that

   (exact-u32* x y)

may provide more control over efficiency than the above compound expression,
involving a lesser number of machine instructions.  When ranges can be inferred,
as in

   (let ((x (blob-u32-ref (endianness big) blob 0))
     (exact-u32* x 5))

one would be in even better shape, since x and the result are known to fit in
a single register and no tags are involved.  In the absence of such procedures,
on a 32 bit architecture, one would need to involve at least two registers for the
result of the multiplication, which would presumably take more machine
cycles, then apply the and, etc.

For arithmetic, perhaps multiples of 8 bits are not so important.  However,
is this specification is supposed to also be usable for fast operations
on blobs, where multiples of 8 are inherent?  If not, perhaps a parallel set of
operations for the blob-inherent types would be useful as a separate library.

Cheers
Andre