LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   MinGW - performance is degarding from linux version to win32 version (https://www.linuxquestions.org/questions/programming-9/mingw-performance-is-degarding-from-linux-version-to-win32-version-739117/)

manu-tm 07-10-2009 03:56 AM

MinGW - performance is degarding from linux version to win32 version
 
Hi everybody!

I've made a linux app that I'm porting to win32 winth MinGW and MSYS. It's a ticker app that reads then renders a text file to a pixmap (a tall single-line image), then it kind of scrolls the pixmap by drawing a part of it to a drawing_area, using gdk_draw_drawable() within a timeout handler set by g_timeout_add().
The problem is it works fine on linux (the scrolling is really smooth and that's the goal) but the win version is choppy and uses at least 90% of cpu resources (vs 15% with linux) like there is a big performance problem. And I'm not even sure that double buffering is set.
Does anyone have an clue? Is it related to some mingw config or drawing_area stuff or gtk for win?

Thank you.

Manu Thomas-Maurin

Mara 07-12-2009 03:23 PM

Try compling the program with -ffast-math.

manu-tm 07-13-2009 06:32 AM

Thanks a lot. I also found that setting process priority to high helps as well. So it's really smooth now. But it's like there is still a "scrolling speed limit" in windows. The image is supposed to be refreshed every interval milliseconds with g_timeout_add(interval,callback,data). With linux I can scroll really fast if I set interval under about 15 ms, but with windows it doesn't make any difference between 15 and 1. Like I can't override a control thing... (but that's windows, not much user control!)
Thanks again anyway.

Manu Thomas-Maurin

bannock 07-13-2009 11:17 AM

Normal windows XP timers have a maximum resolution of 15 ms. You need to use the 'high resolution' timers. I don't know if gtk supports this, but it's probably in use by sound or video apis.

manu-tm 07-14-2009 06:11 AM

Thanks! I'm gonna check this and I will let you know.

manu-tm 07-20-2009 09:17 AM

Quote:

Originally Posted by bannock (Post 3606214)
Normal windows XP timers have a maximum resolution of 15 ms. You need to use the 'high resolution' timers. I don't know if gtk supports this, but it's probably in use by sound or video apis.

Using multimedia win32 timers fixed the problem. I've set some conditional compilation tags, replacing g_timeout_add() with timeSetEvent() for the win32 version and now it's fine. Really smooth and fast. Again, thanks a lot...


All times are GMT -5. The time now is 03:52 PM.