Good performance in linux horrible performance in windows!

hi, in linux the app is so smooth i move the window around without any concern ! the cubes load without prob(will explain what my app is)

on windows its so slow, like in slow motion, and the window takes a year to move and is so laggy ! in linux moving window was super smooth !

in windows it took 50% max cpu in linux it took 96% ! why is it like that ! its exact same code,

the program basically draws a lot of cubes on screen every 16ms !

1
2
3
4
5
6
7
8
9
10
11
void MainWindow::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);

    for(int i=0;i<480;i+=10){
        for(int j=0;j<480;j+=10){
            painter.setBrush(QColor(rand() % 256, rand() % 256, rand() % 256));
            painter.drawRect(i,j,i+10,j+10);
        }
    }
}


the timer event just does a simple repaint(); ! i just made it fast and stupid there might be correction but i only did it for a test :D

why is it like that on windows, anyway to improve it?!
Its not "exact same code". Your part is same, but Qt's code and the OS system libraries are not. Did you use same/similar compiler? Same hardware, I presume?
i used min gw in win and don't know what in linux :)

the code is exactly same i just pasted it into win partition and imported it to qt, checked the code to make sure it has same text !

the computer is exactly same !

edit: Wait, it says 32bit min gw ! also the fact it only uses 50 % cpu max is werid !
Last edited on
As keskiverto said, your code is the same, but the implementation of things like the QPaintEvent and QPainter classes will be most definitely be platform-specific.
Last edited on
i know, but why should the windows version so horrible ?!
How do you measure the 50% and 96%? Do you have a dual-core CPU? I would expect single-threaded program to show 50% in Windows (== one core in use) and 100% in Linux (== one core in use).

Linux has most likely GCC. MinGW is GCC too. The question is, which version of GCC each is?


There is no obvious reason why one platform would be so much different, but there are many potential details.
i have an quad core i5-3570k !

i didn't even make a different thread for it ! (it threaded or parallel or anything)

in linux i used top and in windows i used task manager
i don't know whats the version, you think the windows one is older?!

my main problem is performance :P

and btw : im am not some fanboy :) i just wonder why it would be so much difference between 2 platforms, that can't be right ! (when i read my own post it sounded like im fanboy :D )
Last edited on
i have an quad core i5-3570k !

That is even more interesting. Your program's Linux version uses one core, but the Windows version fills two cores.

g++ --version

(change the 'g++' if your mingw has different commad-name)
Something else to consider along with keskiverto's train of thought is that Qt likes to talk right to the hardware. So what model video card are you using, and what is the driver version on Windows vs. the driver you are using on *nix? SIDE_NOTE: No I don't know what the "ANGLE" project is or what kind of performance this component lends to Qt. So I'll defer to anyone who is more familiar with it if they think that ensures that the video driver is not a factor to the issue at hand.

I haven't had any motivation to take Qt apart yet, but I have noticed in the past that it dynamically links to an older version of comctrl32.dll. This means that when ever it makes a call to display an image that call is going to be filtered through CSRSS potentially slowing down your applications performance. Now I can't say for certain how much, if any impact this will have on your end product but what it does mean is that if all of the easy stuff fails then building Qt from source on the host machine may be back on the board as a solution.
Last edited on
Topic archived. No new replies allowed.