>I have a program that works fine using Remove and Add to update
> a value. The program processes a log file from a router and
[quoted text clipped - 4 lines]
> I can see in the debugger. I need to change the lower case
> "value" but it is protected from change.
Generic::SortedList has updateable indexer property (mUrl[key]). You may
also consider to use hash table instead of sorted list, as "If insertion
causes
a resize, the operation is O(n)." for sorted list, and "If Count is less
than the capacity, this method approaches an O(1) operation." for hash
table.
--
Vladimir Nesterovsky
Bruce Arnold - 27 Sep 2006 06:35 GMT
Vladimir, thanks for the help.
Here's the "final" working code based on your tip.
// This code is about 40 percent faster on a 250,000 line
// datafile with 6000 unique url's. 5 secs to 3.
// -------------------------------------
if (mUrl->TryGetValue(hTokens[2],count))
mUrl[hTokens[2]] = 1 + count;
else
mUrl->Add(hTokens[2], 1);
...Bruce
>>I have a program that works fine using Remove and Add to update
>> a value. The program processes a log file from a router and
[quoted text clipped - 11 lines]
>than the capacity, this method approaches an O(1) operation." for hash
>table.