1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

which is faster (C++)

Discussion in 'Software Development' started by calculus87, Sep 19, 2003.

Thread Status:
Not open for further replies.
  1. calculus87

    calculus87 Thread Starter

    Joined:
    Sep 4, 2003
    Messages:
    34
    Okay,
    my question is this. Which is faster on execution, and why?

    1)storing data in a vector of strings
    or
    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
     
  2. Regicide

    Regicide

    Joined:
    Aug 8, 2003
    Messages:
    307
    When you have a huge amount of varibles, or a couple with huge range of arrays (i.e. char szArray[100000][100000]) the program is going to run alittle slower and might crash. This is because, as you probably already know, everytime you make a varible or an array C++ stores that information in a Hexidecimal value somewhere on your motherboard. For example, look at the szArray, it has 10,000,000,000 (10 BILLION) places for possible characters! So, if C++ (for example) stores the being character (szArray[0][0]) at 171, szArray[100000][10000] is going to be at 10,000,000,171! It is my opinion that you use a file to store the data and only use a couple varibles. This has a less chance of slowing down and crashing. But, you'll need to systematicly store all the information so you can then retrieve it with a formula easily.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/165958

  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