in reply to Unpacking small chucks of data quickly
read does a buffered read (analogous to and possibly implemented in terms of the C fread(3) routine), so even though you're asking for only 8 bytes at a time the underlying read(2) system call isn't going to be called each time.
And probably unrelated speed wise, but your explicitly checking for and allocating an array ref isn't really necessary. Search for "autovivification", but the short answer is just use it in the right place and Perl will have an arrayref there for you.
Not that either of those solves your speed problems . . . :)
Update: and on a second reading, perhaps it's the fact that you're building a structure out of our 100M file in RAM that's the bottleneck. Consider using a hash-on-disk instead of keeping things all in memory.
We're looking for a Perl and Database Developer for Corporate Investments Group.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unpacking small chucks of data quickly
by ikegami (Patriarch) on Nov 19, 2007 at 23:10 UTC |