Click here to Skip to main content
16,019,435 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Active window Pin
jk chan22-Aug-06 14:16
jk chan22-Aug-06 14:16 
AnswerRe: Active window Pin
jpyp23-Aug-06 8:26
jpyp23-Aug-06 8:26 
GeneralRe: Active window Pin
jk chan23-Aug-06 14:15
jk chan23-Aug-06 14:15 
AnswerRe: Active window Pin
jpyp24-Aug-06 8:11
jpyp24-Aug-06 8:11 
GeneralRe: Active window Pin
jk chan24-Aug-06 14:25
jk chan24-Aug-06 14:25 
QuestionCMap with integer keys [modified] Pin
bob1697222-Aug-06 10:16
bob1697222-Aug-06 10:16 
AnswerRe: CMap with integer keys Pin
Jörgen Sigvardsson22-Aug-06 13:56
Jörgen Sigvardsson22-Aug-06 13:56 
GeneralRe: CMap with integer keys [modified] Pin
bob1697222-Aug-06 18:37
bob1697222-Aug-06 18:37 
I think I found out why I'm chasing my tail. Apparently the HashKey function does a bit shift to the right 4 places by default for primitive types. Since I was using such a small sample for my elements (64), most of the integer falls off the right side during the bitshift leaving me with a tiny integer and numerous key collisions invoking the subsequent linear searches for a majority of my elements.

This would explain most of the behaviour I was seeing.

As a quick sobriety check, I bit shifted my keys to the left before insertion and before each lookup and my benchmarks are much more consistent now. I'm not sure what to override the function with as I'm not really knowledgeable of hash functions but at least I know what I'm fighting at this point.

Jörgen Sigvardsson wrote:
Have you tried std::hash_map?


This is on my todo list one of these years. I've been finding it hard to get the time to rid myself of MFC.

Thanks for the reply.
GeneralRe: CMap with integer keys Pin
Blake Miller29-Sep-06 8:37
Blake Miller29-Sep-06 8:37 
GeneralRe: CMap with integer keys Pin
bob169721-Oct-06 7:56
bob169721-Oct-06 7:56 
GeneralRe: CMap with integer keys Pin
Blake Miller2-Oct-06 2:22
Blake Miller2-Oct-06 2:22 
Questionfunction hooks Pin
inebriate22-Aug-06 8:55
inebriate22-Aug-06 8:55 
AnswerRe: function hooks Pin
Jörgen Sigvardsson22-Aug-06 13:54
Jörgen Sigvardsson22-Aug-06 13:54 
AnswerRe: function hooks Pin
Dave Calkins22-Aug-06 18:15
Dave Calkins22-Aug-06 18:15 
Questionexceptions Pin
jon-8022-Aug-06 8:48
professionaljon-8022-Aug-06 8:48 
QuestionRe: exceptions Pin
David Crow22-Aug-06 8:57
David Crow22-Aug-06 8:57 
AnswerRe: exceptions Pin
jon-8022-Aug-06 9:06
professionaljon-8022-Aug-06 9:06 
GeneralRe: exceptions Pin
Zac Howland22-Aug-06 9:10
Zac Howland22-Aug-06 9:10 
GeneralRe: exceptions Pin
David Crow22-Aug-06 9:21
David Crow22-Aug-06 9:21 
GeneralRe: exceptions Pin
Zac Howland22-Aug-06 9:22
Zac Howland22-Aug-06 9:22 
QuestionRe: exceptions Pin
David Crow22-Aug-06 9:32
David Crow22-Aug-06 9:32 
AnswerRe: exceptions Pin
Zac Howland22-Aug-06 9:42
Zac Howland22-Aug-06 9:42 
GeneralRe: exceptions Pin
David Crow22-Aug-06 9:47
David Crow22-Aug-06 9:47 
GeneralRe: exceptions Pin
Zac Howland22-Aug-06 10:08
Zac Howland22-Aug-06 10:08 
GeneralRe: exceptions Pin
David Crow22-Aug-06 10:25
David Crow22-Aug-06 10:25 

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.