LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-10-2009, 03:56 AM   #1
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Rep: Reputation: 43
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
 
Old 07-12-2009, 03:23 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Try compling the program with -ffast-math.
 
Old 07-13-2009, 06:32 AM   #3
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Original Poster
Rep: Reputation: 43
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
 
Old 07-13-2009, 11:17 AM   #4
bannock
LQ Newbie
 
Registered: Jun 2009
Location: Toronto
Distribution: Ubuntu, Fedora
Posts: 24

Rep: Reputation: 18
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.
 
1 members found this post helpful.
Old 07-14-2009, 06:11 AM   #5
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Original Poster
Rep: Reputation: 43
Thanks! I'm gonna check this and I will let you know.
 
Old 07-20-2009, 09:17 AM   #6
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Original Poster
Rep: Reputation: 43
Quote:
Originally Posted by bannock View Post
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...
 
  


Reply

Tags
mingw



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Default socket name and version in Redhat linux with kernal version 2.4-20-8??? sivareddy_jntu Linux - Networking 1 06-12-2009 02:43 PM
Regarding distribution + kernel version + gcc version + glib version. JCipriani Linux - General 8 04-19-2008 02:54 PM
What performance do you get with the ATi fglrx version 8.12? vharishankar Linux - Hardware 5 06-22-2005 04:09 PM
Win32 version of Gprof - Problem motwman Linux - Software 0 03-31-2005 02:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration