Hi guys, I'd appreciate any insight you have on this.
What I am doing is capturing data from a data acquisition card working at 200kS/s and saving the data into a double array. Unfortunately I cannot save the data to file before the next lot of data comes in, so I have resorted to saving 30 seconds worth (the largest amount that would fit in my memory) to RAM and then saving it to disk. Its not ideal.
UPDATE: ________________________
I have found that most of the time is spent converting the various types into a qbytearray. So I think my question has changed, how can I convert a float (or at worst an int) into a qbytearray (or string) quicker than QString::number or QTextStream << does. Thanks.
________________________________
What I then need to do then is save it to a file. So far I have been using the various QString and QTextStream implementations of "float to string" to find that they take a huge amount of time. Much, much slower than the actual writing to the hard drive (which I thought would be the limiting factor).
So I decided to do some tests and I found that even writing text to a file (using qtextstream) is pretty slow (note: in a loop). For a float it takes 24 seconds, for a QByteArray with 9 characters it takes 15.7 seconds.
Now only appending the data to a QByteArray to make one huge array, then writing only takes 3 seconds for a char array but 48s for the float!!! And 24 seconds for an int.
So, down to business, does anyone know how I could write to a file? I'm willing to try anything, so long as its within my fairly limited programming knowledge.




Reply With Quote
Bookmarks