I need to read a file from isolated storage (IsolatedStorageFileStream) as fast as possible. Now I read it per byte. I’m sure that reading in chunks of bytes will be faster. But what is the optimal size of these chunks? Have anyone done such tests?
I need to read a file from isolated storage (IsolatedStorageFileStream) as fast as possible.
Share
Well, I performed test by myself. What I had:
file size = 3 803 264 bytes; testing code snippet:
EDIT: very important point in above snippet is that file.Position and file.Length are requested only once. It has significant positive impact on performance (provided count=1 2370 ms against 55734 ms if position and length are inlined).
What updated results I’ve got:
buffer size (bytes) / time in emulator (ms) / time on my HTC Trophy (ms)
1 / 1197 / 2370
128 / 725 / 1289
1024 / 209 / 163
4096 / 35 / 50
8196 / 35 / 49
whole file at once / 19 / 31