[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Andy Wingo
Subject: subbytevectors
Date: Sat, 09 Jun 2012 13:07:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)


It would be very convenient to offer bytevectors that give a view on
some other data structure, possibly another bytevector.  We already have
that, to an extent, with pointer->bytevector.  We can consecrate that
with some subbytevector facility.

I think it's a good idea but it has some costs.  One is that currently,
in the R6RS bytevector specification, one bytevector cannot alias
another.  This knowledge can allow the optimizer to do more things.
Another point is that since Guile can control the allocation of
bytevectors, it can ensure their alignments, and so compile e.g. a
(bytevector-u32-ref bv 12 (native-endianness)) to an efficient access,
knowing that it is aligned.  If we offer subbytevectors, this won't be
possible in general.

Again, the gain in expressiveness is probably worth it, but I wanted to
put the question out there to see if anyone has an opinion.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]