Re: Byte swapping efficiently



Hi John --

it's shifted the bottleneck away from byte-swapping, which was the
hoped outcome - it's now the simple mechanics of processing 55MB of
data that's holding the app up, but performance is now acceptable.

Depending on the layout of the data, and in what order(s) you need
to access it, you may find it an advantage to map the entire thing
into your process's memory space and treat it as one honkin-huge
array. For an idea of what I'm talking about, take a look at how
quickly this -- http://vb.mvps.org/samples/MapFile -- can
encrypt/decrypt huge files.

If I understand you right, that's pretty much what I'm doing anyway.
Basically, the file's read in two-byte chunks, then (if it's in
Motorola format) a byte-swap, as discussed, is performed for each
chunk. Other than byte-swapping issues, it's pulled into a
two-dimensional array and all other processing done with the data
entirely in memory.

If you're reading the file two bytes at a time, you can increase the
processing speed by quite a number (10+?) orders of magnitude!

Question: Would it be advantageous to have the byte-swapped data stored in
the original file? IOW, overwritten on the original data? If so, and
(especially!) if the above is also true, I'm sure we could kick the crap out
of your current timings.
--
Working without a .NET?
http://classicvb.org/


.