Methods for fast binary file output?

Discussion in 'C++' started by email.ttindustries@gmail.com, Jul 19, 2007.

  1. Guest

    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
    , Jul 19, 2007
    #1
    1. Advertising

  2. 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?


    Possibly, but standard C++ does not specify the speed of any operation.
    Gnerally speaking the closer you get to the underlying operating system
    the faster things will be. But none of that is standard C++, it's
    platform specific.

    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?


    Everything you ask depends upon the C++ you are using, and the operating
    system you are using, maybe even the machine you are using. The answers
    to your questions will depend very much on your particular circumstances.

    If I were you I would try all the different methods you can find and
    time them. That way you can answer your own questions. As to any special
    purpose libraries, I doubt it, but the place to ask is a g++ group or a
    Borland group.

    >
    > Thank you very much
    >
    > Daniel
    >


    john
    John Harrison, Jul 19, 2007
    #2
    1. Advertising

  3. Jim Langston Guest

    <> wrote in message
    news:...
    > 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


    Well, the delay will come in to the physcial read and writes with moving the
    heads, etc... If you buffer the writes then you shouldnt' get that delay.
    This will especially work if you can load the entire data to write in
    memory, although it doesn't sound like you can do that with 20MB/second.

    Another alternative is to use threads. Send a write request to a thread
    safe que that another thread reads to write the data, then your main thread
    shouldn't have to wait for the file i/o to complete. This will probably work
    as long as the writing thread can keep up with writing 20MB/second. I
    really don't know how fast HDs are nowadays with MB/second but 20 should be
    fine.

    You might want to discuss this in comp.programming.threads
    Jim Langston, Jul 20, 2007
    #3
  4. Just me Guest

    On Thu, 19 Jul 2007 07:45:29 -0700, email.ttindustries 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
    > 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?


    Do you REALLY need to sample at 20MB/s? Can you lower the sampling rate
    to something realistic and still get adequate samples? That would be my
    first question.
    Just me, Jul 23, 2007
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    661
  2. Michele Simionato

    Python is darn fast (was: How fast is Python)

    Michele Simionato, Aug 23, 2003, in forum: Python
    Replies:
    13
    Views:
    558
  3. Replies:
    3
    Views:
    816
    SM Ryan
    Jul 21, 2007
  4. Juha Nieminen
    Replies:
    22
    Views:
    1,022
    Kai-Uwe Bux
    Oct 12, 2007
  5. Kenneth McDonald
    Replies:
    5
    Views:
    312
    Kenneth McDonald
    Sep 26, 2008
Loading...

Share This Page