
I tend to agree with Alastair. I just reran the experiments with BinIOs instead of BinMems to see if there was a greater difference (I expect a much smaller difference, in fact, due to the high disk overhead and the fact that putChar is slow). I didn't both with -O0, but with -O2, we get:
bits read 2156 write 2639
bytes read 1617 write 2078
frankly, this shocks me. reading using bits is 33% slower; writing is about 27% slower. i actually expected the bits version to be *faster* (relatively, of course) here, due to the fact that we have much smaller files (the byte-based file is 4200000 bytes while the bit-based file is 3325000 bytes). With a 33% difference, I think I might want separate instances again :).
Try profiling. It's hard to tell where the speed is going without seeing the code - would you like to put it up somewhere so we can take a look? Remember that putByte and friends have been carefully tuned, I suspect we'll need to take a close look at the compiler output for your bit versions and tweak a few things. Cheers, Simon