Methods for fast binary file output?

E

email.ttindustries

Hello,

I am a C/C++ newbie and I have a simple question concerning fast data
writing to binary files. Are there any other faster methods than the
standard write() method to write to binary data files? I ask this
question because I have to store a big amount of data coming from an
PCI A/D card with a sampling frequency of 20 MB/s. Now I have to
implement some additional computations and would need to speed up the
data transfer. I am using a Windows XP computer and GCC 3.4.3 and
Borland 5.5 respectively. Are there any special free libraries for
this purpose?

Thank you very much

Daniel
 
S

santosh

Hello,

I am a C/C++ newbie and I have a simple question concerning fast
data writing to binary files. Are there any other faster methods
than the standard write() method to write to binary data files? I
ask this question because I have to store a big amount of data
coming from an PCI A/D card with a sampling frequency of 20 MB/s.
Now I have to implement some additional computations and would need
to speed up the data transfer. I am using a Windows XP computer and
GCC 3.4.3 and Borland 5.5 respectively. Are there any special free
libraries for this purpose?

Thank you very much

Standard C only has fwrite for this purpose. If this is not
satisfactory, (have you actually measured and found it to be so?),
you'll have to see what your system provides. There may be special
API by which you can specify increased buffering, asynchronous I/O
and the like. But ultimately, the limiting factor is likely to be
the speed of your disks. If you really need the writes to as fast as
possible, invest in a RAID array of fast SCSI disks and more memory.

At 20 MB/s, I don't think you need to worry about the disk writes
stalling your program.
 
M

Malcolm McLean

Hello,

I am a C/C++ newbie and I have a simple question concerning fast data
writing to binary files. Are there any other faster methods than the
standard write() method to write to binary data files? I ask this
question because I have to store a big amount of data coming from an
PCI A/D card with a sampling frequency of 20 MB/s. Now I have to
implement some additional computations and would need to speed up
the data transfer. I am using a Windows XP computer and GCC 3.4.3
and Borland 5.5 respectively. Are there any special free libraries for
this purpose?
Not nowadays. If fwrite() won't write the data fast enough then you need a
physically superior backing store. That didn't use to be the case and you
could play around with buffers to make them match physical disk segments,
but with a modern processor it won't make any difference.
 
S

SM Ryan

(e-mail address removed) wrote:
# Hello,
#
# I am a C/C++ newbie and I have a simple question concerning fast data
# writing to binary files. Are there any other faster methods than the
# standard write() method to write to binary data files? I ask this

Maybe memory mapped files if you have them available. Memory map
uses the CPU to write bytes and only goes to kernel on page faults.
The kernel might also guess to preallocate pages before you fault.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top