View topic - How can I write a lot of data in the RAM to file fast.

Page 1 of 1

How can I write a lot of data in the RAM to file fast.

PostPosted: Thu Aug 09, 2012 3:32 am
by xuehuazhou
My question is lots of data need to be save , but when I used fwrite() or write() , I found it too slow, maybe 20+M/s. However, the sata harddisk write /read speed up to 100-200M/s. And I 'm not sure the fwrite () or write() function using the DMA mode or PIO mode, how can I solve the problem. Please help me, thank you.
PS:I'm so sorry ,my English is poor ,so I am no sure that the problem is clear or not.

Re: How can I write a lot of data in the RAM to file fast.

PostPosted: Thu Aug 09, 2012 12:24 pm
by denkelly
read() and write() are faster then fread()/fwrite().

Re: How can I write a lot of data in the RAM to file fast.

PostPosted: Fri Aug 10, 2012 8:10 pm
by maschoen
xuehuazhou wrote:My question is lots of data need to be save , but when I used fwrite() or write() , I found it too slow, maybe 20+M/s. However, the sata harddisk write /read speed up to 100-200M/s. And I 'm not sure the fwrite () or write() function using the DMA mode or PIO mode, how can I solve the problem. Please help me, thank you.
PS:I'm so sorry ,my English is poor ,so I am no sure that the problem is clear or not.


The SATA read/write speeds you mentioned is probably the wire speed. That's the speed that data goes through the SATA cable. There are many other constraints. For example, on read, you will get no faster speed then the data passing under the heads. Once the write cache is filled, the same will be true on writes. There are numerous places that overhead can occur. The QNX file system is not known for blazingly fast I/O either. It is however optimized for multi process access.