[r6rs-discuss] [Formal] bytevector aliasing severely impedes optimizations

From: Aubrey Jaffer <agj>
Date: Mon Mar 5 15:33:58 2007

 | From: William D Clinger <will_at_ccs.neu.edu>
 | Date: Mon, 05 Mar 2007 10:36:48 -0500
 |
 | I am posting this as an individual member of the Scheme
 | community. I am not speaking for the R6RS editors, and
 | this message should not be confused with the editors'
 | eventual formal response.
 |
 | Brad Lucier wrote:
 | > I presume that many people might want to use bytevectors as described
 | > in this report to increase computational speed and decrease memory
 | > requirements by avoiding boxing/unboxing of objects that might
 | > otherwise be boxed when held in generic vectors.
 |
 | Me too. I have been assuming that someone would write
 | a SRFI for type-specific numeric vectors together with
 | a portable R6RS reference implementation using bytevectors
 | encapsulated within records.

SRFI-63 provides type-specific numeric arrays (including vectors)
encapsulated within records. Its portable R5RS reference
implementation is in terms of vectors, Scheme numbers, and SRFI-9
records.

 | If you or I were to write that SRFI, it would solve the
 | aliasing problem without even having to mention it. In
 | theory, compilers could optimize the portable reference
 | implementation; in practice, it might be easier for a
 | compiler to optimize the SRFI using the compiler's own
 | representation, but the reference implementation would
 | still have conceptual value and would reduce the burden
 | on implementors who don't care to optimize such things.

The SLIB byte-number conversion library
(http://cvs.savannah.gnu.org/viewcvs/slib/slib/bytenumb.scm?view=markup)
documented at http://swiss.csail.mit.edu/~jaffer/slib_7.html#SEC189,
provides portable byte-number conversions for unsigned and
twos-complement integers and IEEE-754 numbers (including infinities,
NaN and -0). Its only limitation is that it does not distinguish
between different NaNs.

 | So I'm wondering why this needs to be part of the R6RS
 | instead of being a SRFI.

I can write a reference implementation for all SRFI-63 uniform-typed
arrays in terms of SRFI-63 uniform unsigned byte-vectors (A:fixN8b) in
a couple hours.

Would my proposed reference implementation satisfy your requirements?
Received on Mon Mar 05 2007 - 15:33:12 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC