Hi,
I have a (320,240) array of data that I need to write to and read from disk. What is the most efficient way of doing this?
This is an integer array, where each value is either 0 or 1.
I currently convert these to a single binary string that where each position is a binary value of either CHR$(0) or CHR$(255). This gets written to disk, and loaded again.
This means I end up with a single string with 76800 positions that then get parsed out into an array again:
The time it takes to write the info to disk is not very important (It is game level information, which gets created once, but loaded many times) The time it takes to load the data from disk and rebuild the original array does need to be as short as possible though.
Is there a faster/better way or writing a full array, or am I on the right track? I *figure* it will be faster to load a 77K string in one go and parse it out, than 77K individual variable reads... But I may be missing something entirely here.
Thoughts, anyone?
I have a (320,240) array of data that I need to write to and read from disk. What is the most efficient way of doing this?
This is an integer array, where each value is either 0 or 1.
I currently convert these to a single binary string that where each position is a binary value of either CHR$(0) or CHR$(255). This gets written to disk, and loaded again.
This means I end up with a single string with 76800 positions that then get parsed out into an array again:
For x=0 To 319 For y=0 To 239 If Mid$(GfxOverlay$(2),(x+1)+(y*320),1)=Chr$(255)Then walkability(x,y)=1 Else walkability(x,y)=0 End If Next Next
The time it takes to write the info to disk is not very important (It is game level information, which gets created once, but loaded many times) The time it takes to load the data from disk and rebuild the original array does need to be as short as possible though.
Is there a faster/better way or writing a full array, or am I on the right track? I *figure* it will be faster to load a 77K string in one go and parse it out, than 77K individual variable reads... But I may be missing something entirely here.
Thoughts, anyone?