[Haskell-cafe] API for reading a big binary file
ranjan.bagchi at frotz.com
Thu Dec 21 16:47:48 EST 2006
I'm still learning to use ghc effectively, and I'm trying to use it
for more-or-less mundane programming tasks, hopefully in a way which
is a lot more elegant than I'd do in Java or Perl.
I've got a big [around a gigabyte] binary file, filled with identical
binary structures (imagine a C process writing structs). I'd like to
process/analyze them efficiently. In C or even Java, i'd memory map
the file and extract the data I need.
Is there a fast way to do this using ghc? I can extract fields by
using a ByteString, but I may not be using it fast enough: I've had
to write my own routines to extract ints, longs and doubles.
The other option is to write the loading code largely in C, but I'm
not clear how to write a data type which maps well to a C struct.
Any help / examples would really be appreciated.
More information about the Haskell-Cafe