Click here to Skip to main content
16,010,473 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralStupid question Pin
eli1502197926-Mar-05 21:49
eli1502197926-Mar-05 21:49 
GeneralRe: Stupid question Pin
Graham Bradshaw26-Mar-05 23:35
Graham Bradshaw26-Mar-05 23:35 
GeneralRe: Stupid question Pin
eli1502197927-Mar-05 3:11
eli1502197927-Mar-05 3:11 
GeneralRe: Stupid question Pin
David.Kelly4-Apr-05 11:04
David.Kelly4-Apr-05 11:04 
Generalchange bitmap button during runtime Pin
Yaron Abershitz26-Mar-05 21:49
Yaron Abershitz26-Mar-05 21:49 
GeneralRe: change bitmap button during runtime Pin
namaskaaram27-Mar-05 16:50
namaskaaram27-Mar-05 16:50 
GeneralEvent Threading Pin
zx2c426-Mar-05 16:30
zx2c426-Mar-05 16:30 
GeneralLinked Lists & Arrays and Locality of Reference Pin
Ziro_026-Mar-05 16:28
Ziro_026-Mar-05 16:28 
Hello, all.
I have some comments about linked lists & arrays and locality of reference.

Adding a node to a list a traditional method:
allocate each node using the new operator, then hook it into the list using "prev" and
"next" pointers.
This is fine, except that if you traverse the list a lot, accessing each node could
caused a missed cache hit or page fault, degrading application performance.

However, using an array-based structure to hold each data element offers much better locality of reference (all the nodes and data in one big allocation).
The drawback here is that it is harder to grow the array (reallocate to the new size,
then copy all the stuff over).

If you are not sure of how many nodes the list will contain, or if the data is some
complex structure, you may want to use a traditional method.
If you know exactly what the maximum capacity will be or if the data structure is
an fairly simple, and you traverse the list a lot, it may be worthwhile to store the
nodes in an array.

What it really concludes to, is it depends on what you are trying to do.
What do you all think? Smile | :)
GeneralRe: Linked Lists & Arrays and Locality of Reference Pin
Michael Dunn26-Mar-05 20:33
sitebuilderMichael Dunn26-Mar-05 20:33 
GeneralRe: Linked Lists & Arrays and Locality of Reference Pin
Anonymous27-Mar-05 6:05
Anonymous27-Mar-05 6:05 
GeneralVC++ relationship between low-level objkects and GUI interfaces Pin
Anonymous26-Mar-05 10:41
Anonymous26-Mar-05 10:41 
GeneralRe: VC++ relationship between low-level objkects and GUI interfaces Pin
PJ Arends26-Mar-05 11:12
professionalPJ Arends26-Mar-05 11:12 
GeneralGlobal Function Pin
Static(x)26-Mar-05 9:49
Static(x)26-Mar-05 9:49 
GeneralRe: Global Function Pin
PJ Arends26-Mar-05 11:18
professionalPJ Arends26-Mar-05 11:18 
GeneralRestarting the process!! Pliz help Pin
mpapeo26-Mar-05 9:41
mpapeo26-Mar-05 9:41 
GeneralRe: Restarting the process!! Pliz help Pin
Gary R. Wheeler26-Mar-05 13:53
Gary R. Wheeler26-Mar-05 13:53 
GeneralRe: Restarting the process!! Pliz help Pin
mpapeo27-Mar-05 3:04
mpapeo27-Mar-05 3:04 
GeneralRe: Restarting the process!! Pliz help Pin
Gary R. Wheeler27-Mar-05 3:40
Gary R. Wheeler27-Mar-05 3:40 
GeneralRe: Restarting the process!! Pliz help Pin
mpapeo27-Mar-05 4:06
mpapeo27-Mar-05 4:06 
GeneralAES imlementation in VC++ Pin
26-Mar-05 9:08
suss26-Mar-05 9:08 
GeneralFew questions, involving 64 bit file support. Pin
Master Shake 14426-Mar-05 7:32
Master Shake 14426-Mar-05 7:32 
GeneralRe: Few questions, involving 64 bit file support. Pin
Ravi Bhavnani26-Mar-05 12:17
professionalRavi Bhavnani26-Mar-05 12:17 
GeneralRe: Few questions, involving 64 bit file support. Pin
PJ Arends26-Mar-05 12:41
professionalPJ Arends26-Mar-05 12:41 
GeneralRe: Few questions, involving 64 bit file support. Pin
Ravi Bhavnani26-Mar-05 12:44
professionalRavi Bhavnani26-Mar-05 12:44 
GeneralRe: Few questions, involving 64 bit file support. Pin
Graham Bradshaw26-Mar-05 23:37
Graham Bradshaw26-Mar-05 23:37 

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.