File IO optimisation

Discussion in 'C' started by RidARiddle, May 5, 2010.

  1. RidARiddle

    RidARiddle New Member

    Joined:
    May 5, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Hi all,
    I joined the forum today. I have a question whether two file reads will take more time than a single file read for same data size or vice-versa.

    Thanks in advance.
     
  2. LynxSI

    LynxSI New Member

    Joined:
    May 23, 2010
    Messages:
    30
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Software Developer
    Location:
    Vancouver, BC, Canada
    Home Page:
    http://www.lynxsi.ca/
    Of course it will. That is like me asking if it will take you longer to carry my books up some stairs in two trips instead of one trip. ;-)

    This problem could get worse if I asked you to perform a second task in between trips! (Like another program making a disk operation during your software's disk operations. This could cause the harddrive to seek to another sector and then have to seek back to the original sector to continue your second read.)

    Of course if you are doing only a few file operations occasionally, you will never notice. So it might not be worth your time to optimise. However, for any intense applications like database systems, or large file handling for video editing, graphics editing, etc.. you will want to carefully analyze your code for any place it could be possible to simplify it and reduce disk activity.

    - Ben
     
  3. RidARiddle

    RidARiddle New Member

    Joined:
    May 5, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Thanks LynxSI.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice