Re: fast serialization of huge bit vectors?

Jens Thiele <[email protected]> Wed, 29 Apr 2026 07:09:16 +0200
Newsgroups gmane.lisp.scheme.gauche
Message-ID <[email protected]>
Shiro Kawai <[email protected]> writes:

> Binary I/O of bitvectors is an interesting idea.  Yes, binary
> representation of bitvector has more parameters to consider:
>
> - Unit of 'word' --- do we dump bytewise, or 2/4/8-byte wordwise? If the
> latter, word endianness matter.
> - Bit endianness --- MSB first or LSB first
> - Data boundary --- If the data is a bitstream / bit-packed, the data
> boundary may not fall on the byte boundary (e.g. compressed data)
>
> I think bitstream is rather a special case and can be handled separately.
>
> For quick data dump/restore purpose, we should use natural word size and
> endianness, as byte/bit swapping defeats the purpose.  Another possibility
> is to allow aliasing bitvector and uvector (like uvector-alias).  Then you
> can use uvector binary I/O.  Actually, aliasing may be generally useful for
> handling binary data and treating part of it as a bitmap.  What do you
> think?

I always forget about uvector-alias, but yes, sounds great - as always
you have the much better ideas :-)

jens