GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 19-Sep-2003, 13:18
calculus87's Avatar
calculus87 calculus87 is offline
Junior Member
 
Join Date: Sep 2003
Location: FLorida
Posts: 41
calculus87 is on a distinguished road
Question

which is faster (C++)


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
__________________
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  
Old 23-Sep-2003, 03:54
Garth Farley Garth Farley is offline
Invalid Email Address
 
Join Date: May 2002
Location: Ireland
Posts: 638
Garth Farley is a jewel in the roughGarth Farley is a jewel in the roughGarth Farley is a jewel in the rough
Hey.

This is a tough question to answer. It's quite a large chunk of data, so will you have enough memory for 800pages worth of strings?

Since you're operating on them frequently, then yes that'd be to fastest option - if you've done it right. You should try and have the data sorted in the memory, to speed up fetch times.

However, if you run out of memory, there goes you're operation.

On the other hand, you'll definately have plenty of space on the HD for the data, but how to store it so that you can look up stuff in it fast? It'd have to be sorted to be most efficient, and then it has to be binary searched each time something is wanted - will be slow.

So I hope you've got the memory!
GF
 
 

Recent GIDBlogStupid Management Policies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 08:25.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.