PDA

View Full Version : Qt4 slow like molasses



Tommytrojan
16th June 2010, 23:04
Hi,

I'm in the process of porting an app from Qt3 to Qt4. I have a moderately complex dialog with one list view (QTreeWidget) which is basically empty (it has two items in there) and a handful of buttons. See the two attachments for the Qt3 and Qt4 dialog screenshots.
In Qt3 resizing the dialog is is really snappy like you would expect from a normal dialog. In Qt4 however, the resize operation is so slow that the buttons seem to 'jump out of the dialog'. They seem to have some kind of momentum and the entire dialog looks distorted. What am I doing wrong. This can't be the normal performance of Qt4, this would not be usable as a commercial application. Any ideas?


Thomas

wysota
17th June 2010, 02:16
It's hard to say anything based on a screenshot.

ChrisW67
17th June 2010, 04:38
Could be a goofy layout, 1990 hardware, or any number of things. Have you hand coded the dialog or is it Designer built? Can you post a small compile-able example that shows the behaviour on your machine?

Tommytrojan
17th June 2010, 06:17
I'll see if I can shoot a video of the two to demo the issue. You can pretty much imagine moving the mouse resizing the window and the window lagging behind about a second or so, looks weird. I think we can exclude the hardware or the OS (Windows 7) since Qt3 is fast as a scalded monkey and Qt4 slow as molasses.

The layout is pretty simple, there are at most two nested layouts and if that makes it that slow I'd be concerned about the rest of the system. Besides, the layouts are pretty much the same on Qt3 and Qt4. I replaced the QTreeWidget with a QLabel just to make sure it is not something with the QTreeWidget. There is a small speedup but still at least a magnitude slower than Qt3.

I'll see if I can get a small run-able sample together that exhibits the problem.
I'm thinking it could have something to do with the layouts, the Vista style, or maybe the fonts and anti-aliasing. Any pointers are welcome.

Cheers,
Thomas

squidge
17th June 2010, 07:56
Have you tried to compile in release mode? For me, a number of things are very slow in debug mode, but are perfectly usable in release mode.

Tommytrojan
17th June 2010, 08:01
Good point. I'll try and run the release version. For Qt3 I have been using release code, so that could definitely make a difference. I'll report back as soon as I get a chance to test it.

T

wysota
17th June 2010, 08:30
I'll see if I can shoot a video of the two to demo the issue.
I don't think this will help, we believe you that it is slow, no need to convince us. Showing some code would be so much more helpful.

Tommytrojan
17th June 2010, 15:02
Have you tried to compile in release mode? For me, a number of things are very slow in debug mode, but are perfectly usable in release mode.

Tested in release mode and it is way faster! So that is definitely part of it. However, I tried the same debug version on two other (inferior machines) and the response is immediate, no sluggishness whatsoever! Go figure.

All systems are 64-bit Windows 7.

Now the slow system is actually the fastest with a Core 2 Duo T9550 @ 2.67 GHz, 4GB RAM NVIDIA Quadro NVS 160M. Windows Experience: 4.4

My little netbook is way faster, no delay whatsoever:

U2300 @ 1.2 GHz, 4GB RAM, built in Intel Graphics, Windows Experience: 3.2

Desktop:
AMD Athlon 64 X2 Dual Core 5200+ @ 2.6GHz, 6GB RAM, ATI Radeon X1300 Series (Windows driver - WDDM), Windows Experience: 4.1

So I figure it can't be the hardware by itself. Maybe the graphics adapter. Although the Nvidia is one of the fastested among these machines.

The strange thing is that Qt3 runs perfectly fine even on the slow machine. The good news is that there are some systems where it performs fine. It would be good to figure out what the underlying problem is. Looks like it is running slowest on the fastest hardware...

Cheers,
Thomas

wysota
17th June 2010, 17:42
It would be good to figure out what the underlying problem is. Looks like it is running slowest on the fastest hardware...
Try changing your system password...

tbscope
17th June 2010, 18:06
The strange thing is that Qt3 runs perfectly fine even on the slow machine. The good news is that there are some systems where it performs fine. It would be good to figure out what the underlying problem is. Looks like it is running slowest on the fastest hardware...

My experience with Qt4 is that it's very fast on Windows. A simple dialog like this should not lag.
I can see one reason why it could be lagging and that is if there's not enough processing power to handle the paint events.

But to be sure you should try to create a minimal working example, or post your code, like already asked above.
Maybe you did something wrong with the tree widget for example.

Tommytrojan
17th June 2010, 19:10
My experience with Qt4 is that it's very fast on Windows. A simple dialog like this should not lag.
I can see one reason why it could be lagging and that is if there's not enough processing power to handle the paint events.

But to be sure you should try to create a minimal working example, or post your code, like already asked above.
Maybe you did something wrong with the tree widget for example.

Well, it seems to run fast on two of my three machines, so I wouldn't understand how this could be my code, if I'd do something foolish I would expect it to be slow on all machines.

ChrisW67
18th June 2010, 01:55
Then it is environmental. Ship your slow machine to me and I'll have a look ;)

You'll have to work out what else is running on the "slow" machine? Antivirus scanning in the background, Windows updating a search index, zombie process(es) sitting on 100% CPU. Are all the machines running identical versions of the Qt run time libs? What about Windows patches? Switch the slow machine to the generic SVGA driver...