Click here to Skip to main content
15,910,303 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralSmart Tag for Rich Edit of Outlook email viewer Pin
Rajeev K Srivastava3-Apr-05 9:35
Rajeev K Srivastava3-Apr-05 9:35 
GeneralCan't get data from my vector. Help!!! Pin
Larry Mills Sr2-Apr-05 9:42
Larry Mills Sr2-Apr-05 9:42 
GeneralBrowser Helper Object Pin
nmhuy30-Mar-05 21:42
nmhuy30-Mar-05 21:42 
GeneralRe: Browser Helper Object Pin
Nicholas Cardi1-Apr-05 4:00
Nicholas Cardi1-Apr-05 4:00 
GeneralProblem while Persisting Image into Control Pin
ajalilqarshi30-Mar-05 3:58
ajalilqarshi30-Mar-05 3:58 
GeneralMultiple Inclusion Pin
Gomzy29-Mar-05 22:09
sussGomzy29-Mar-05 22:09 
QuestionPlease help. Is multimap what I need? Pin
knapak29-Mar-05 13:37
knapak29-Mar-05 13:37 
AnswerRe: Please help. Is multimap what I need? Pin
Joaquín M López Muñoz30-Mar-05 6:27
Joaquín M López Muñoz30-Mar-05 6:27 
Well, if I understand your scenario correctly, you have two valid alternatives:
  • Scan the whole file into a multimap and use this later several times.
  • Improve your file searching by doing something like a binary search on it. This is a little complex, but doable: broadly sketched, you have to open the file and set the current offset to the middle of it, skip characters until you find a newline and then read the entry: if the tag is id-1, keep on reading till you get to your target portion and proceed. If the tag is greater than that, set the offset to 1/4 of the file, else set it to 3/4, proceed recursively etc.
If you'll be doing the search many times, the multimap solution is probably faster, otherwise you'll have better performance with binary searching on the file. We can do an estimate: Let us call N the number of entries (10 millions in your case) and S the number of search operations you're going to perform on the file. Each search takes approximately log2N entry readings, so the binary search method will read in total S*log2N file entries. With the first method, the entries read are exactly N, as you scan the entire file. So the first method is better (on a first approximation) than the second if

N < S*log2N

With 10 million entries, this means the first method wins if you do more than ~430,000 search operations. I guess you won't do that many searches, hence my hunch is that you're probably better off implementing the file binary search stuff. Hope this helps a little.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
GeneralRe: Please help. Is multimap what I need? Pin
knapak30-Mar-05 11:44
knapak30-Mar-05 11:44 
GeneralCString to &lt;string&gt; help please.. Pin
mlatimer28-Mar-05 19:25
mlatimer28-Mar-05 19:25 
GeneralRe: CString to &lt;string&gt; help please.. Pin
rwestgraham29-Mar-05 14:32
rwestgraham29-Mar-05 14:32 
QuestionHow to Access properties of Control? Pin
ajalilqarshi28-Mar-05 19:01
ajalilqarshi28-Mar-05 19:01 
General[wtl] Making a Wizard-Only app Pin
Member 1219625228-Mar-05 2:12
Member 1219625228-Mar-05 2:12 
GeneralRe: [wtl] Making a Wizard-Only app Pin
Ernesto D.4-Apr-05 14:55
Ernesto D.4-Apr-05 14:55 
Generalcomponents with multiple interfaces Pin
yqzq27-Mar-05 22:14
yqzq27-Mar-05 22:14 
GeneralEvent Threading Pin
zx2c426-Mar-05 16:32
zx2c426-Mar-05 16:32 
GeneralRe: Event Threading Pin
Nicholas Cardi1-Apr-05 4:08
Nicholas Cardi1-Apr-05 4:08 
QuestionIsn't it possible to Persist SAFEARRAYs? Pin
ajalilqarshi25-Mar-05 22:18
ajalilqarshi25-Mar-05 22:18 
AnswerRe: Isn't it possible to Persist SAFEARRAYs? Pin
Michael Dunn26-Mar-05 9:56
sitebuilderMichael Dunn26-Mar-05 9:56 
GeneralRe: Isn't it possible to Persist SAFEARRAYs? Pin
ajalilqarshi27-Mar-05 19:15
ajalilqarshi27-Mar-05 19:15 
GeneralCustom ActiveX control Pin
foxyspy24-Mar-05 20:20
foxyspy24-Mar-05 20:20 
QuestionHow to lock child window from resizing in MDI ? Pin
Mandalay24-Mar-05 19:35
Mandalay24-Mar-05 19:35 
AnswerRe: How to lock child window from resizing in MDI ? Pin
Pharago22-Apr-05 1:29
Pharago22-Apr-05 1:29 
Generalhash_map iterator error Pin
ravjak20-Mar-05 21:51
ravjak20-Mar-05 21:51 
GeneralRe: hash_map iterator error Pin
CP Visitor20-Mar-05 23:47
CP Visitor20-Mar-05 23:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.