1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Rep Power

    Question which is faster (C++)

    my question is this. Which is faster on execution, and why?

    1)storing data in a vector of strings
    2) opening a file and storing the data in the file.

    note: there is about 800 pages of data.
    note: I will also be accessing the data several times in the program
    This message is a natural product made from recycled electrons. The slight
    variations in spelling and grammar enhance its individual character and
    beauty and in no way are to be considered flaws or defects.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Flint, MI
    Rep Power
    Without question, storing data in the vector will be faster. This is because memory access is always faster than disk access. The only time this will not be true is if your system is overloaded and it is swapping memory to disk. That situation implies though that your system is overloaded anyway, and you need more hardware. Hopefully that is not the case.
    Clay Dowling
    Lazarus Notes
    Articles and commentary on web development

IMN logo majestic logo threadwatch logo seochat tools logo