Can we have an option to set the buffer size when creating a stream? Using ReadInt(stream) on thousands of individual integers in a file is extreemly slow. It would be nice to say "hey I want a buffer of 512k on this stream". I think that should speed things up a lot given that it looks like there is no buffering going on right now.
Buffered TStreams
BlitzMax Forums/BlitzMax Programming/Buffered TStreams Except there (usually) is...
BlitzMax uses 'c' streams under the hood for plain file streams, which are already buffered.
A buffered stream may indeed be useful, but buffering an already buffered stream probably wont achieve much.
BlitzMax uses 'c' streams under the hood for plain file streams, which are already buffered.
A buffered stream may indeed be useful, but buffering an already buffered stream probably wont achieve much.
My bad, been a while since I've used C. Isn't default buffer size something like 128 bytes though?
How about instead of some buffering you supply methods for reading large numbers of non-byte values in the endian stream types. Make sure to read them into a buffer first and then reorder the bytes for the platform. Faster than converting them one at a time.
Read( buf:Byte Ptr,count ) <-- this is already there
TStream.readShorts(buf:Short Ptr, count)
TStream.readInts(buf:Int Ptr, count)
TStream.readFloats(buf:Float Ptr, count)
TStream.readDoubles(buf:Double Ptr, count)
Read( buf:Byte Ptr,count ) <-- this is already there
TStream.readShorts(buf:Short Ptr, count)
TStream.readInts(buf:Int Ptr, count)
TStream.readFloats(buf:Float Ptr, count)
TStream.readDoubles(buf:Double Ptr, count)