Looks like the solution was to do buffered I/O. I was able to reduce the time taken by FileOpen()or FileTruncate() from 22 seconds to about 1 second by filling 16Kbyte buffers first and then writing 16Kbytes at a time to the filestreams.
Lorraine
At 02:42 PM 3/31/2005 -0500, you wrote:
Hi Jonathan,
No it's on a T3 but thanks for the info anyway.
Lorraine
At 02:16 PM 3/31/2005 -0500, you wrote:Hi Lorraine,
Is this on a T5? If so, the delay is probably caused by the flushing of the DBCache to NAND Ram (non-volatile ram). The algorithm that is used for that seems to take a minimalist approach to flushing so on a series of consecutive writes, it can cause a significant delay. Also, as detailed in other postings here, there isn't a way to effectively flush the cache.
Hope this helps!
-Jon
------------------------------------------- Jonathan Hays Palm OS Certified Developer http://hazelware.luggle.com -------------------------------------------
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Lorraine Chin Sent: Thursday, March 31, 2005 10:35 AM To: Palm Developer Forum Subject: FileOpen/FileTruncate takes 22 seconds!
I write to 3 files in RAM until all but 512Kbytes of the 50 Mbytes of RAM is filled. The 2 largest files tend to be written in alternating order as the data specific to each file comes in over the port. 1 file is written to 72 bytes at a time. The larger file is written to 272 bytes at a time. The 3rd file is written only once at the beginning and is only 119 bytes.
When I call FileOpen with fileModeReadWrite or FileTruncate on the 3 files, it takes 22 seconds!
If I fill the RAM halfway, it only takes about 5 seconds. But even 5 seconds for a Palm API to return is way too long.
What on earth could be causing this and more importantly, can I do anything about it?
By the way, I didn't use to have this long delay problem with FileOpen/FileTruncate when all the data used to be stored in a single large file. That single large file also contained writes that alternated between 72 and 272 bytes in length.
Thanks in advance for the advice, Lorraine
--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
