Click here to Skip to main content
15,890,186 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: computational cost of math functions Pin
leon de boer17-Apr-20 7:04
leon de boer17-Apr-20 7:04 
GeneralRe: computational cost of math functions Pin
Calin Negru17-Apr-20 8:14
Calin Negru17-Apr-20 8:14 
GeneralRe: computational cost of math functions Pin
Joe Woodbury17-Apr-20 10:43
professionalJoe Woodbury17-Apr-20 10:43 
GeneralRe: computational cost of math functions Pin
kalberts17-Apr-20 11:47
kalberts17-Apr-20 11:47 
GeneralRe: computational cost of math functions Pin
Joe Woodbury17-Apr-20 12:53
professionalJoe Woodbury17-Apr-20 12:53 
GeneralRe: computational cost of math functions Pin
kalberts17-Apr-20 13:03
kalberts17-Apr-20 13:03 
AnswerRe: computational cost of math functions Pin
CPallini17-Apr-20 7:04
mveCPallini17-Apr-20 7:04 
AnswerRe: computational cost of math functions Pin
kalberts17-Apr-20 12:37
kalberts17-Apr-20 12:37 
Are you really sure that it matters?

It might, in some very special applications. But most developers tend to overestimate the relative fraction of "calculation" in their code. The data handling often takes up a far larger fraction of the processing time that they thought.

Also: How often do you have a real choice? If your algorithm calls for a sin(), is there anything you can do to avoid it? Not very often! If you do have a choice, implementations vary so much that you should set up a simple test bed and try it out.

One thing I have learnt through simple timing tests: On any CPU architected the last 30 years, timing individual instructions is more or less meaningless. Prefetching and pipelining and speculative execution and whathaveyou can make addition of a simple instruction (e.g. arithmetic) almost unnoticable on the execution time of a tight loop. So don't worry about those.

What really matters is not the execution time of the trig functions (and other mathematiclly complex operations) in themselves, but the number of times you call them. I never programmed any ray tracing myself, but I would not be surprised if there is a lot to be saved in caching, reusse and clever prioritizing to make the most visible effects appear first, details only if you have got the time to do it, before the next update.
GeneralRe: computational cost of math functions Pin
harold aptroot17-Apr-20 16:12
harold aptroot17-Apr-20 16:12 
AnswerRe: computational cost of math functions Pin
Calin Negru18-Apr-20 8:56
Calin Negru18-Apr-20 8:56 
Questionmfc LoadBitmap hangs my application... Pin
charlieg15-Apr-20 12:21
charlieg15-Apr-20 12:21 
AnswerRe: mfc LoadBitmap hangs my application... Pin
_Flaviu16-Apr-20 1:37
_Flaviu16-Apr-20 1:37 
GeneralRe: mfc LoadBitmap hangs my application... Pin
charlieg16-Apr-20 4:30
charlieg16-Apr-20 4:30 
GeneralRe: mfc LoadBitmap hangs my application... Pin
_Flaviu16-Apr-20 5:24
_Flaviu16-Apr-20 5:24 
GeneralRe: mfc LoadBitmap hangs my application... Pin
leon de boer16-Apr-20 6:29
leon de boer16-Apr-20 6:29 
GeneralRe: mfc LoadBitmap hangs my application... Pin
_Flaviu16-Apr-20 7:21
_Flaviu16-Apr-20 7:21 
GeneralRe: mfc LoadBitmap hangs my application... Pin
charlieg16-Apr-20 9:47
charlieg16-Apr-20 9:47 
GeneralRe: mfc LoadBitmap hangs my application... Pin
charlieg16-Apr-20 10:27
charlieg16-Apr-20 10:27 
GeneralRe: mfc LoadBitmap hangs my application... Pin
leon de boer16-Apr-20 16:37
leon de boer16-Apr-20 16:37 
GeneralRe: mfc LoadBitmap hangs my application... Pin
charlieg17-Apr-20 9:43
charlieg17-Apr-20 9:43 
QuestionWindows CBT Hooks Pin
Richard Andrew x6414-Apr-20 11:58
professionalRichard Andrew x6414-Apr-20 11:58 
GeneralRe: Windows CBT Hooks Pin
Richard MacCutchan14-Apr-20 21:21
mveRichard MacCutchan14-Apr-20 21:21 
GeneralRe: Windows CBT Hooks Pin
Richard Andrew x6415-Apr-20 4:28
professionalRichard Andrew x6415-Apr-20 4:28 
GeneralRe: Windows CBT Hooks Pin
Richard MacCutchan15-Apr-20 4:57
mveRichard MacCutchan15-Apr-20 4:57 
GeneralRe: Windows CBT Hooks Pin
Richard Andrew x6415-Apr-20 5:49
professionalRichard Andrew x6415-Apr-20 5:49 

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.