[r6rs-discuss] Re: [Formal] bytevector aliasing severely impedes
optimizations (Sam TH)
Ludovic Courtès
ludovic.courtes at laas.fr
Mon Mar 5 13:13:21 EST 2007
Hi,
Bradley Lucier <lucier at math.purdue.edu> writes:
> If, instead of bytevectors, R6RS had homogenous vectors as in SRFI 4,
> this could be inferred from the text of the program.
However, SRFI-4 vectors are not handy for binary I/O, precisely because
they are homogeneous. FWIW, I recently implemented ONC RPC and XDR
using the bytevector API and found it very convenient.
The interesting thing is that either type can be implemented in terms of
the other. Implementing SRFI-4 on top of bytevectors raises aliasing
issues. Implementing bytevectors on top of SRFI-4 vectors may be
inefficient (except for accesses of the type of the underlying SRFI-4
vector) because the representation conversion code would need to operate
on regular (boxed) numbers (e.g., assuming a u8vector is used,
`bytevector-u32-ref' needs to fetch 4 numbers, and then perform the
appropriate arithmetic and bitwise operations).
Maybe that's a sign that both abstractions are useful on their own?
Thanks,
Ludovic.
More information about the r6rs-discuss
mailing list