Click here to Skip to main content
15,922,512 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Custom Draw Pin
RobJones28-Nov-01 10:57
RobJones28-Nov-01 10:57 
GeneralRe: Custom Draw Pin
Michael Dunn28-Nov-01 13:58
sitebuilderMichael Dunn28-Nov-01 13:58 
QuestionAvoid flickering in list control? Pin
User 665828-Nov-01 9:16
User 665828-Nov-01 9:16 
AnswerRe: Avoid flickering in list control? Pin
Michael Dunn28-Nov-01 9:56
sitebuilderMichael Dunn28-Nov-01 9:56 
QuestionAre there faster accessing arrays than vectors? Pin
Chambers28-Nov-01 9:00
Chambers28-Nov-01 9:00 
AnswerRe: Are there faster accessing arrays than vectors? Pin
Christian Graus28-Nov-01 12:32
protectorChristian Graus28-Nov-01 12:32 
AnswerRe: Are there faster accessing arrays than vectors? Pin
Todd Smith28-Nov-01 14:44
Todd Smith28-Nov-01 14:44 
AnswerRe: Are there faster accessing arrays than vectors? Pin
Chambers29-Nov-01 8:50
Chambers29-Nov-01 8:50 
Yeah I`m only storing integers in the vectors, and as Christian said I can`t understand why the vectors are so slow. However, I`ve since adopted a pointer to an int system, and used a small calculation to work out the position of the relevant integer in the list that is to be used in the convolution stuff. Result - it was sh**loads faster. Just by changing from vectors to pointers made an absolutely massive difference (it was literally the difference between almost instansteously performing the convolution, and waiting a good few seconds for the *exact* same code to run through). I think it must just be because I`m accessing my vectors like so:

...
for (int i=0; i<3; i++)
  for (int j=0; j<3; j++)
    {
      *blue = blue + *(pBits+0) * myVector[a][b];
      *green = green + *(pBits+1) * myVector[a][b];
      *red = red + *(pBits+2) * myVector[a][b];
    }
...


Instead of using myVector, I use pointers to an int (pInt - for arguments sake, and cos I like pInts of strongbow!), as follows : *(pInt+(a*width+b));
And the result is that its loads faster. Hope someone can shed some light on why this is the case, although it doesn`t matter to me now, I`d still like to know why? Thanks guys,

Cheers,
Alan.

P.S. Christian, I think to me, you and the others who are improving their C++ vocabulary every day, reading pointer code is a *relatively* simple task. However, the reason I mentioned this before is that some of my MSc markers are real programming bone heads (the're mathematicians), so I was just thinking that such people might find it *easier* to read and *understand* the vector code, what do you reckon? I`m gonna go with the pointer stuff anyway, it just means extra explanation in the final write up. Cheers though for your advice I do appreciate it.


"When I left you I was but the learner, now I am the Master" - Darth VaderMad | :mad:
GeneralRe: Are there faster accessing arrays than vectors? Pin
Chris Losinger29-Nov-01 11:08
professionalChris Losinger29-Nov-01 11:08 
GeneralRe: Are there faster accessing arrays than vectors? Pin
Todd Smith29-Nov-01 12:11
Todd Smith29-Nov-01 12:11 
GeneralRe: Are there faster accessing arrays than vectors? Pin
Todd Smith29-Nov-01 12:24
Todd Smith29-Nov-01 12:24 
GeneralRe: There are faster accessing arrays than vectors! Pin
Chambers30-Nov-01 2:39
Chambers30-Nov-01 2:39 
GeneralVery strange behavior in ActiveX control, pleas help Pin
Bill Wilson28-Nov-01 8:51
Bill Wilson28-Nov-01 8:51 
QuestionHow to map return-key(enter) from combobox? Pin
Pony28-Nov-01 7:52
Pony28-Nov-01 7:52 
GeneralSoftware Documentation Pin
28-Nov-01 7:48
suss28-Nov-01 7:48 
GeneralRe: Software Documentation Pin
Mike Nordell28-Nov-01 17:28
Mike Nordell28-Nov-01 17:28 
GeneralTo Christian Graus & Nish Pin
Karavaev Denis28-Nov-01 7:21
Karavaev Denis28-Nov-01 7:21 
GeneralRe: To Christian Graus & Nish Pin
Chris Losinger28-Nov-01 7:46
professionalChris Losinger28-Nov-01 7:46 
GeneralRe: Who are these guys? Pin
Masaaki Onishi28-Nov-01 9:47
Masaaki Onishi28-Nov-01 9:47 
GeneralRe: Who are these guys? Pin
Karavaev Denis28-Nov-01 17:20
Karavaev Denis28-Nov-01 17:20 
GeneralRe: To Christian Graus & Nish Pin
Karavaev Denis28-Nov-01 17:23
Karavaev Denis28-Nov-01 17:23 
GeneralRe: OK, This is a tricky one! Pin
Masaaki Onishi28-Nov-01 17:34
Masaaki Onishi28-Nov-01 17:34 
GeneralI think, I'm an idiot .... Pin
Karavaev Denis28-Nov-01 17:47
Karavaev Denis28-Nov-01 17:47 
GeneralRe: I think, I'm an idiot .... Pin
Masaaki Onishi28-Nov-01 18:44
Masaaki Onishi28-Nov-01 18:44 
GeneralRe: I think, I'm an idiot .... Pin
Karavaev Denis28-Nov-01 19:01
Karavaev Denis28-Nov-01 19:01 

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.