in reply to Unpacking small chucks of data quickly

read is buffered, so the 8-bytes at a time isn't so bad. You could try reading more at a time and replacing calls to read with calls to substr and see if that's faster. I don't think it'll help, but only a benchmark will tell.

not defined $ValArrayByID{$ID} and $ValArrayByID{$ID} = []; is redundant (and rather unreadable as written) since push already does this.

You don't handle read returning anything but 0 or $length. It could return -1 on error, or a number less than $length if fewer than $length bytes are available at the time.