On 10/12/06, ara.t.howard / noaa.gov <ara.t.howard / noaa.gov> wrote:
> On Fri, 13 Oct 2006, Tim Pease wrote:
> >
> > No problem. Take a look at bit-struct if you find yourself needing to
> > do some more complex packing and unpacking of binary data ...
> >
> > http://raa.ruby-lang.org/project/bit-struct/
> >
> > Blessings,
> > TwP
>
> have you been using this for your stuff tim?
>

No, we've just been parsing very large pixel images.  No complex data
structures.  Read four bytes, mask off the hamming code and error
bits, store the pixel data in an mmap cache, repeat until EOF.

From the bit-struct readme ...

"BitStruct is most efficient when your data is primarily treated as a
binary string, and only secondarily treated as a data structure. (For
instance, you are routing packets from one socket to another, possibly
looking at one or two fields as it passes through or munging some
headers.) If accessor operations are a bottleneck, a better approach
is to define a class that wraps an array and uses pack/unpack when the
object needs to behave like a binary string."


TwP