DX9: huge file eating, eating up resources

Started by
11 comments, last by Moleculo 20 years, 5 months ago
Yes, adding a Sleep at the end is the way to go. I prefer Sleep(0) since it will give any remaining time left in the thread to other threads, but only if it is needed. If the other threads on the system don''t need all of it then your program will get the rest back.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
Advertisement
I was experimenting a little bit with that sleep function as follows:

void message_pump(void){
MSG msg;

if(PeekMessage(&msg, NULL, 0, 0,PM_REMOVE)){
TranslateMessage(&msg);
DispatchMessage(&msg);

}
Sleep(10);
}

0 and 1 milliseconds didnt do much with 10 however my CPU usage dropped dramatically, without losing the programs'' "functionality" its kind of insane...

So correct me here; the program adds a sort of break/pause to the message pump rate, right? But how can this NOT affect the performance, I mean frames will have to be dropped...
It all depends on what you have running in the background. It''s very probable that the program is taking a slight performance hit; however, it might not be a big enough hit for you to notice.

If adding a sleep statement to the code allows you to do what you want on your laptop, and you don''t notice a performance hit, I''d say use it.
SysOp_1101

This topic is closed to new replies.

Advertisement