BinaryReadList with Mixed Types
- To: mathgroup at smc.vnet.net
- Subject: [mg92965] BinaryReadList with Mixed Types
- From: Raffy <raffy at mac.com>
- Date: Tue, 21 Oct 2008 06:23:30 -0400 (EDT)
When BinaryReadList is used with mixed types like
{"UnsignedInteger32", "Real32"}, the speed at which it imports is
incredibly slow.
count = 10000;
file = OpenWrite["Slow.dat", BinaryFormat -> True];
BinaryWrite[file,
Transpose@{RandomInteger[{0, 1}, count],
RandomReal[{0, 1}, count]}, {"UnsignedInteger32", "Real32"}];
Close[file];
file = OpenWrite["Fast.dat", BinaryFormat -> True];
BinaryWrite[file,
RandomReal[{0, 1}, {count, 2}], {"Real32", "Real32"}];
Close[file];
BinaryReadList["Slow.dat", {"UnsignedInteger32", "Real32"}]; // Timing
--- takes about 0.5 sec
BinaryReadList["Fast.dat", {"Real32", "Real32"}]; // Timing --- a few
ms at most
Is there anyway I can fix this performance? The current speed is
completely unacceptable.
Thank you.