I have to read MPEG TS files and parse the TS packets, but I have some ‘reading speed’ issues.
[code] Dim f As FolderItem
Dim bs As BinaryStream
dim length,dummy as Int64
dim m as memoryblock
f = GetOpenFolderItem("")
If f <> NIL And f.Exists Then
bs = BinaryStream.Open(f, False)
If bs <> Nil Then
length=f.Length / 188
for dummy=0 to length-1
m = bs.Read(188,NIL)
NewPacket(m)
next
'Do
'NewPacket( bs.Read(188))
'loop until bs.eof
bs.Close
End If
End If[/code]
this code need 13 seconds (sample file) to process and 21 seconds using the do loop / method. Any change to speed that up as the same file is read and processed in ~4 seconds using Java.
for dummy=0 to length
NewPacket( bs.read( 188 ) )
next[/code]
I suspect that the main cause of the slowdown is probably within the NewPacket function. I use binary stream in many applications in many places and it’s certainly fast enough.
Personally, my concern with doing this is pushing the application memory usage up, so that it spills over and then ends up swapping. Especially if the OP is reading movie files.