I'm still looking for a performant way to load a file with 50.000.000 signed shorts. Now I'm testing loading BYTEs, then coverting it to SHORTs. Trying to convert a big Byte-Array into a big Short Array
if the element size is 100.000 the speed is very fast: <10msec
if I try to do it with 300.000 elements the time is extremly high >5000msec
The loading time is 70msec only, but the converting seems to cause the problem. What ca I do?
Some additional Test:
if I try this, the time is again >1400msec
if I try this, the time is <10msec
So it looks like the calculating and the storing are the problems
if the element size is 100.000 the speed is very fast: <10msec
if I try to do it with 300.000 elements the time is extremly high >5000msec
B4X:
Private zeit As Long = DateTime.now
Private buffer() As Byte
Private Value(2200000) As Short
buffer = File.ReadBytes(File.DirAssets,"Myfile.BIN")
Log("ZEIT A=" & (DateTime.now-zeit))
Log("BUFFER SIZE= " & buffer.Length)
For i= 0 To 300000 'buffer.length/2-2
Value(i)=buffer(2*i+1)*256+buffer(2*i)
Next
Log("ZEIT B=" & (DateTime.now-zeit))
The loading time is 70msec only, but the converting seems to cause the problem. What ca I do?
Some additional Test:
if I try this, the time is again >1400msec
B4X:
...
buffer = File.ReadBytes(File.DirAssets,"ShortExport.MCA")
...
Private xxx as Short
For i= 0 To 300000 'buffer.length/2-2
Value(i)=0
Next
Log("ZEIT B=" & (DateTime.now-zeit))
if I try this, the time is <10msec
B4X:
...
...
Private xxx as Short
For i= 0 To 300000 'buffer.length/2-2
xxx=buffer(0)
Next
Log("ZEIT B=" & (DateTime.now-zeit))
So it looks like the calculating and the storing are the problems
Last edited: