Click here to Skip to main content
15,891,431 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Fastest code Pin
Maximilien11-Jun-03 6:51
Maximilien11-Jun-03 6:51 
GeneralRe: Fastest code Pin
doctorpi11-Jun-03 6:56
doctorpi11-Jun-03 6:56 
GeneralRe: Fastest code Pin
David Crow11-Jun-03 7:27
David Crow11-Jun-03 7:27 
GeneralRe: Fastest code Pin
doctorpi11-Jun-03 7:37
doctorpi11-Jun-03 7:37 
GeneralRe: Fastest code Pin
Mike Nordell12-Jun-03 8:44
Mike Nordell12-Jun-03 8:44 
GeneralRe: Fastest code Pin
doctorpi12-Jun-03 10:59
doctorpi12-Jun-03 10:59 
GeneralRe: Fastest code Pin
jhwurmbach11-Jun-03 23:32
jhwurmbach11-Jun-03 23:32 
GeneralRe: Fastest code Pin
jbarton11-Jun-03 7:51
jbarton11-Jun-03 7:51 
If possible, you should run your code inside a profiler. The design of your program (and the algorithm choices made for how to process data) will affect how fast the program runs, but you shouldn't unnecessarily make changes to code that is already debugged and running correctly.

What you want to do is identify what areas of the code are using the most cpu time, and concentrate any effort in optimizing to those areas that actually make a difference. Even with a lot of experience with what code sequences are slow versus fast, it is a waste of effort to fix parts that only take a small amount of the total time (even if they are written using a slow algorithm). This is where the profiler will help. Use it to find the areas of your program which are taking the largest amount of time to execute, and concentrate any effort on speedups to those areas. (If one part of the program is taking 90% of the time, any effort spent on improving other parts of the program can only get you at most a 10% improvement).

As far as using tricks - I would avoid any "tricky" sequence of code. You are more likely to get it wrong, and even if you get it right, it makes future maintenance more difficult.

For compiler options, I would just choose whatever optimizations match the most likely target machine for the program.

Best regards,
John
GeneralRe: Fastest code Pin
doctorpi11-Jun-03 7:56
doctorpi11-Jun-03 7:56 
GeneralRe: Fastest code Pin
jbarton11-Jun-03 8:43
jbarton11-Jun-03 8:43 
GeneralRe: Fastest code Pin
basementman12-Jun-03 6:46
basementman12-Jun-03 6:46 
QuestionHow do you initialize a structure with a CPoint member? Pin
kleft11-Jun-03 5:38
kleft11-Jun-03 5:38 
AnswerRe: How do you initialize a structure with a CPoint member? Pin
valikac11-Jun-03 6:30
valikac11-Jun-03 6:30 
GeneralRe: How do you initialize a structure with a CPoint member? Pin
kleft11-Jun-03 7:40
kleft11-Jun-03 7:40 
GeneralRe: How do you initialize a structure with a CPoint member? Pin
David Crow11-Jun-03 8:07
David Crow11-Jun-03 8:07 
AnswerRe: How do you initialize a structure with a CPoint member? Pin
Anonymous12-Jun-03 7:09
Anonymous12-Jun-03 7:09 
Questionhow do I connect to other PCs with parallel port Pin
anhnt7911-Jun-03 5:29
anhnt7911-Jun-03 5:29 
AnswerRe: how do I connect to other PCs with parallel port Pin
valikac11-Jun-03 6:32
valikac11-Jun-03 6:32 
Generalftp problem Pin
t.ucello11-Jun-03 5:22
t.ucello11-Jun-03 5:22 
GeneralRe: ftp problem Pin
valikac11-Jun-03 6:42
valikac11-Jun-03 6:42 
GeneralRe: ftp problem Pin
basementman12-Jun-03 6:50
basementman12-Jun-03 6:50 
GeneralInstalling VC6 SP5 Pin
yarp11-Jun-03 5:09
yarp11-Jun-03 5:09 
GeneralRe: Installing VC6 SP5 Pin
SNathani11-Jun-03 8:21
SNathani11-Jun-03 8:21 
GeneralRe: Installing VC6 SP5 Pin
yarp11-Jun-03 20:05
yarp11-Jun-03 20:05 
GeneralCompiler switches Pin
doctorpi11-Jun-03 5:03
doctorpi11-Jun-03 5:03 

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.