Click here to Skip to main content
15,899,313 members
Home / Discussions / C#
   

C#

 
AnswerRe: Propertygrid creating internal sub properties for a property Pin
visualhint9-Oct-06 14:12
visualhint9-Oct-06 14:12 
QuestionSuppress Line in Crystal Report Pin
M Riaz Bashir8-Oct-06 21:25
M Riaz Bashir8-Oct-06 21:25 
Questionupdating VFP data with C# 2005 Pin
Bob Enein8-Oct-06 19:33
Bob Enein8-Oct-06 19:33 
QuestionBinary Formatter error Pin
uglyeyes8-Oct-06 15:13
uglyeyes8-Oct-06 15:13 
QuestionHow to minimize & zip the access Data base size? Pin
Emad Abo Aiad8-Oct-06 14:39
Emad Abo Aiad8-Oct-06 14:39 
AnswerRe: How to minimize & zip the access Data base size? Pin
Christian Graus8-Oct-06 15:54
protectorChristian Graus8-Oct-06 15:54 
GeneralRe: How to minimize & zip the access Data base size? Pin
Emad Abo Aiad10-Oct-06 3:58
Emad Abo Aiad10-Oct-06 3:58 
QuestionAny container gurus out there (Dictionary and SortedDictionary) Pin
Julien8-Oct-06 13:53
Julien8-Oct-06 13:53 
Hey all,
I need to describe what I'm doing before I can ask my question, so bear with me.

I have implemented a 'limited-heap' where N columns of my DataRow define unqueness.
And M different columns define the sort order so that I can discard rows beyond arbitary MaxRows.

I have a Dictionary<int64,datarow> (ie: a hash table with order(1) lookup)
and a SortedDictionary<int64,int64> (ie: a balanced tree on the key).

I make an Int64 Key from the N Columns in the row, If it exists in my heap I aggregrate some of the data and increment a counter. If it does Not exist I add it.
All this uses the Dictionary<>

Now the magic bit I need to remove the Least Significant row as defined by the M Columns.
So I need them sorted. So I add it to the SortedDictionary<>.
Then If I have More than MaxRows in there, I lookup the first row in my SortedDictionary and remove it from both. (Note that the Value section of the SortedDictionary is not needed).

Now my Question:
I implemented this twice. In the first one I put the Int64 key value from the Dictionary as my key value in my SortedDictionary, then I supplied a Comparer to lookup the Dictionary for the value to compare.

In the second I put the actual DataRow in the SortedDictionary and made sure the comparer used this instead.

Why would this be slower?
My Inserts and Removes from the SortedDictionary was were I lost performace, but I dont know why.

All I can think of is that the referene to the dataRow is bigger than the Int64 keyvalue. And therefore required more memory (but this is my c++ head thinking here, and I don't know if this applies in c#)

Thoughts anyone?

nb: Sorry to be so long.
AnswerRe: Any container gurus out there (Dictionary and SortedDictionary) Pin
Christian Graus8-Oct-06 15:52
protectorChristian Graus8-Oct-06 15:52 
GeneralRe: Any container gurus out there (Dictionary and SortedDictionary) Pin
Julien9-Oct-06 12:55
Julien9-Oct-06 12:55 
GeneralRe: Any container gurus out there (Dictionary and SortedDictionary) Pin
Christian Graus9-Oct-06 13:04
protectorChristian Graus9-Oct-06 13:04 
QuestionFlatAppearance.BorderSize Pin
antonpaolo8-Oct-06 12:04
antonpaolo8-Oct-06 12:04 
QuestionWhy use exceptions...? Pin
Mark068-Oct-06 10:15
Mark068-Oct-06 10:15 
AnswerRe: Why use exceptions...? Pin
Nico van der Plas8-Oct-06 11:32
Nico van der Plas8-Oct-06 11:32 
AnswerRe: Why use exceptions...? Pin
Guffa8-Oct-06 12:06
Guffa8-Oct-06 12:06 
AnswerRe: Why use exceptions...? Pin
Christian Graus8-Oct-06 11:44
protectorChristian Graus8-Oct-06 11:44 
AnswerRe: Why use exceptions...? Pin
Guffa8-Oct-06 12:04
Guffa8-Oct-06 12:04 
AnswerRe: Why use exceptions...? Pin
Ennis Ray Lynch, Jr.8-Oct-06 13:12
Ennis Ray Lynch, Jr.8-Oct-06 13:12 
QuestionDuration of Media in C# Pin
ytubis8-Oct-06 10:13
ytubis8-Oct-06 10:13 
AnswerRe: Duration of Media in C# Pin
Christian Graus8-Oct-06 11:50
protectorChristian Graus8-Oct-06 11:50 
AnswerRe: Duration of Media in C# Pin
Niiiissssshhhhhuuuuu8-Oct-06 17:47
Niiiissssshhhhhuuuuu8-Oct-06 17:47 
QuestionPrinting Problem ...... Pin
galigal158-Oct-06 7:42
galigal158-Oct-06 7:42 
Questionstring array property Pin
Tuwing.Sabado8-Oct-06 6:37
Tuwing.Sabado8-Oct-06 6:37 
AnswerRe: string array property Pin
Nader Elshehabi8-Oct-06 6:40
Nader Elshehabi8-Oct-06 6:40 
GeneralRe: string array property Pin
Tuwing.Sabado8-Oct-06 7:05
Tuwing.Sabado8-Oct-06 7:05 

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.