The Fine Print: The following comments
are owned by whomever posted them.
( Reply )
|
Re: Memory usage..
by Mark Hannessen on Wednesday 26/Mar/2008, @10:41
|
That's probably true,
But i must say that it does load apps a lot faster then kde3.
I myself don't really care that much about usage, what i care about is performance. thought usage optimization is always welcome.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Bille on Wednesday 26/Mar/2008, @11:57
|
Yeah, I still feel bad for spreading that one. Must do better. Anyway, it's "retracted", not "redacted".
|
[
Reply To This | View ]
|
Re: Memory usage..
by Leo S on Wednesday 26/Mar/2008, @21:56
|
Oops. You're right. Major brain fart on that one.
|
[
Reply To This | View ]
|
|
Re: Memory usage..
by Tom on Wednesday 26/Mar/2008, @12:57
|
But in Qt4 there is implicit sharing of most basic classes which makes it use less memory, so logically, it uses less memory. It is of course also dependant on how you use Qt4, but even programmers who don't care about how many copies they make of some 'QString' or whatever, will use less memory because of this sharing.
So if KDE4 uses more memory, then I think that to build the same thing with KDE3, you would use even more memory :)
|
[
Reply To This | View ]
|
Re: Memory usage..
by Anon on Wednesday 26/Mar/2008, @13:26
|
"But in Qt4 there is implicit sharing of most basic classes which makes it use less memory, so logically, it uses less memory."
No, because you're ignoring the portions of Qt4 that use far more memory than Qt3. The most important of these is double-buffering of *all* widgets, *all* the time. By way of demonstration: A single Kwrite window is nearly all widgets. On a 32-bit 1600x1200 monitor, the double-buffering for our Kwrite Window will take up a little under 4 bytes * 1600 * 1200 ~ 7.5 *megabytes*. There's no way that Qt4's meagre savings in strings and QObjects will even come close to this, and so we are in the situation of having a text editor use many megabytes more than its Qt3/KDE3 counterpart. Open 5 kwrite instances, and you are gobbling up a ludicrous *35MB* *just* for the double-buffering on the widgets.
Qt4's so-called "optimisations" are one of the best examples of the phrase "Penny wise, pound foolish" imaginable.
|
[
Reply To This | View ]
|
Re: Memory usage..
by jstaniek on Wednesday 26/Mar/2008, @15:00
|
Note that the buffering occurs only near the paint events. Unless I have missed something, and unless you have 5 displays: you do not have all the windows maximized and displayed/redrawn in the same time. Moreover, aren't paint events limited to rectangle regions, e.g. in KWrite: to the line where you're typing your text?
|
[
Reply To This | View ]
|
Re: Memory usage..
by Anon on Wednesday 26/Mar/2008, @15:08
|
No, unfortunately they are buffered continuously - even if they are on a separate desktop and you haven't used them for several hours :/ (As a corollary, it doesn't matter if only a small region of a window is updated.)
If the buffering was only used during paint events and then discarded for widgets that have not been re-painted in a while, then this would be pretty cool and efficient, but that's not the case.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Zack on Wednesday 26/Mar/2008, @21:16
|
Yes, Qt4 uses more video memory (which isn't difficult because realistically it's really difficult to be using less than 0 which we've been using up until Qt4) but it uses a lot less RAM.
So on systems with dedicated video memory it fallows that Qt uses a lot less memory. At least as far as you as a user of the API are concerned since, obviously, vmem is not where your application/library data is being held.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Leo S on Wednesday 26/Mar/2008, @22:05
|
Hmm. Well on linux the memory used by double buffering shows up in the Xorg process. Don't think this is stored in video memory, unless free is incorrectly counting video memory.
In one sense, double buffering is great. It removes most UI flicker without any effort on the part of the application devs. For my own commercial Qt development, it is a huge advantage. But on the other hand, the cost is quite large when every app you run is completely double buffered, and it doesn't seem really necessary all the time. For example, not all widgets suffer from flicker in Qt3. It's really only things like a file view in a file manager or some other complex widgets. And yet in Qt4, every single widget is double buffered, with the corresponding memory cost.
And the problem is, turning off double buffering in Qt4 globally turns any Qt4 app into a huge flickering mess, with every single widget flickering like crazy, even widgets like menus and toolbars that don't flicker on Qt3 or GTK. So what's the difference? Did Qt3 manually double buffer those widgets?
|
[
Reply To This | View ]
|
Re: Memory usage..
by Kevin Kofler on Thursday 27/Mar/2008, @01:50
|
Qt 3 had some tricks to reduce flicker without double buffering (for example, there used to be a "bool noErase" parameter to QWidget::repaint), which have been dropped in Qt 4 because double buffering is now used.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Leo S on Thursday 27/Mar/2008, @09:34
|
Perhaps the widget attribute Qt::WA_OpaquePaintEvent is the equivalent in Qt4.
|
[
Reply To This | View ]
|
Re: Memory usage..
by jstaniek on Thursday 27/Mar/2008, @02:12
|
"""And the problem is, turning off double buffering in Qt4 globally turns any Qt4 app into a huge flickering mess, with every single widget flickering like crazy, even widgets like menus and toolbars that don't flicker on Qt3 or GTK. So what's the difference? Did Qt3 manually double buffer those widgets?"""
No need to enable/disable double buffering globally. From http://doc.trolltech.com/4.0/qt4-arthur.html#widget-double-buffering:
"Double-buffering is turned on by default, but can be turned off for individual widgets by setting the widget attribute Qt::WA_PaintOnScreen.
unbufferedWidget->setAttribute(Qt::WA_PaintOnScreen);"
|
[
Reply To This | View ]
|
Re: Memory usage..
by Leo S on Thursday 27/Mar/2008, @10:03
|
Yep I've done this before on some special widgets, like one that displays frames from a camera.
However I just did an experiment on an app I'm working on. The biggest memory cost is obviously the main window widget itself. It has a huge double buffering pixmap, and takes the most memory. So what happens if you disable double buffering on just the main widget, but leave it enabled on all others?
Well, on the plus side, there is no added flicker, even if you disable double buffering on the main widget. All the widgets that actually would flicker, like buttons, menus, checkboxes, etc. are still double buffered, so the UI is just as nice as before. And the vast majority of the memory hit is gone. A maximized window takes about 6mb less Xorg memory when I disable double buffering on the main window.
However, there is one downside. Widgets that are transparent now have a grey background instead. So checkboxes have a grey rectangle background instead of letting the default style background show through. This is with the oxygen style.
If you choose the Plastique style instead, then everything looks much better. Because the window background is grey anyway, the fact that checkboxes are not transparent is irrelevant. So in this case you get the 6mb of ram back for basically free. Not really a realistic option for most apps, but hey..
I attached a comparison screenshot of the same app running with double buffering disabled on the main widget, using the oxygen and the plastique style to see the difference.
buffering.png
48KB (49837 bytes)
|
[
Reply To This | View ]
|
Re: Memory usage..
by koos on Thursday 27/Mar/2008, @13:38
|
Sounds like a great idea, since lots of windows are there as a container for other widgets. In my little extra gear project, the main window is completely covered with dock windows.
However with qt4.4 coming soon, there is only one native window and thus one double buffer. Just tried it with trunk and indeed the app looks completely broken with setAttribute(Qt::WA_PaintOnScreen);, docks aren't updated properly neither is the menubar and statusbar.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Leo S on Thursday 27/Mar/2008, @13:57
|
>> However with qt4.4 coming soon, there is only one native window and thus one double buffer.
Are you sure? I think each widget still has its own double buffer. The native window issue is separate.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Anon on Thursday 27/Mar/2008, @14:11
|
Your analysis is correct.
|
[
Reply To This | View ]
|
Re: Memory usage..
by koos on Thursday 27/Mar/2008, @14:38
|
No, just a guess actually. Hmm, I need to figure out why the app is so broken then, maybe paint events aren't passed to child widgets ...
|
[
Reply To This | View ]
|
Re: Memory usage..
by jstaniek on Thursday 27/Mar/2008, @02:15
|
""even widgets like menus and toolbars that don't flicker on Qt3 or GTK. ""
No idea what graphics card os settings you have but on Linux and Windows these items flicker _heavily_ and noticeable if you have switchable context like in KWord or Kexi.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Leo S on Thursday 27/Mar/2008, @09:29
|
Hmm, I hadn't noticed. I meant during normal usage, like mousing over a toolbar or a menu item they didn't flicker. But Qt4 with double buffering disabled flickers on the same actions.
|
[
Reply To This | View ]
|
Re: Memory usage..
by jstaniek on Thursday 27/Mar/2008, @02:15
|
""even widgets like menus and toolbars that don't flicker on Qt3 or GTK. ""
No idea what graphics card or settings you have but on Linux/Qt3 and Windows/Qt3 these items flicker _heavily_ and noticeable if you have switchable context like in KWord or Kexi.
|
[
Reply To This | View ]
|
Re: Memory usage..
by JeanPaul on Thursday 27/Mar/2008, @11:28
|
What is the double buffering for anyway? If I look at the poor way windows and widgets are drawn at the moment (I'm referring to 4.0.2), I don't expect double buffering there. Or am I missing something?
|
[
Reply To This | View ]
|
Re: Memory usage..
by Leo S on Thursday 27/Mar/2008, @11:49
|
The poor way windows are drawn? Can you elaborate? They are drawn nicely here.
Every widget is double buffered in Qt4, and by extension KDE4. For example, dragging a window in front of a dolphin's file view does not cause any flicker as the file view refreshes, as it used to in KDE3.
|
[
Reply To This | View ]
|
Re: Memory usage..
by JeanPaul on Monday 31/Mar/2008, @09:49
|
With "poorly drawn" I mean that I can see the window redrawing on a maximizing/restore/minimize in a very shaky way, and no compositing effects are smooth animations, even doing something simple like selecting file->new for example in any kde4 program makes that file menu pop up, then it disappear, then it is redrawn again, which is killing my user experience. And all that while my gfx card (a GeForce8600M) obviously can (and does) run compiz smoothly (except for fsaa, but that's another problem altogether anyway).
|
[
Reply To This | View ]
|
|
Re: Memory usage..
by Thiago Macieira on Wednesday 26/Mar/2008, @15:47
|
If you compare application to application, a simple one, you'll find that it does take less memory. That's what my tests indicated, by counting the marginal memory usage after the desktop libraries was already loaded (using /proc/<PID>/smaps). My testcase was kwrite.
Two things make it VERY hard to say that "KDE 4 uses less memory than KDE 3":
1) it's not a fair comparison, since the features and services are very different. The experience with KDE 4 is much different from KDE 3. If you really want low memory usage and you're not worried about new features and bugfixes, you can keep using a very old KDE version, or even DOS...
2) it's very difficult to account for memory usage for more than one application. One is easy because you know what is not shared with anyone else. With two or more, you have to ask: what is shared between those applications? And how many pages? We currently don't have the answer for that, but Andrew Morton (kernel developer) mentioned that 2.6.25 will contain a better interface to do just that.
In any case, the 40% figure came from a user that, while well-intentioned, had very little clue about what he was doing. What amazes me is that the press and the public keep referring to those numbers even after we publicly debunked them.
You'll notice that Matthias did not confirm the numbers. He's aware of memory efficiency improvements in Qt 4 and KDE 4 code, but he'll not vouch for a hard number like 40%.
|
[
Reply To This | View ]
|
Re: Memory usage..
by koos on Wednesday 26/Mar/2008, @18:34
|
In an addition to the fellow mentioning the extra mem usage of double buffering.
You'll find this in this in the memory of the Xserver not in /proc/<PID>/smaps of the app, as this typically is done using XPixmaps.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Leo S on Wednesday 26/Mar/2008, @22:08
|
I'm not really complaining about memory usage. More advanced frameworks use more resources. That's just the way things go. But due to double buffering, the same app on Qt4 will use more memory than using Qt3. The process itself might take less, but the cost of double buffering easily erases that small advantage.
And looking at the memory usage of the full desktop running typical apps, it is definitely much more than in KDE3. Like I said, I'm not complaining, but I don't think anyone would seriously argue that it is the case.
|
[
Reply To This | View ]
|
|
Re: Memory usage..
by Segedunum on Wednesday 26/Mar/2008, @15:48
|
"Its funny how one incorrect and quickly redacted measurement can convince so many people. KDE 4 certainly does not take less memory than KDE 3, and I don't think that myth is doing anyone any favours."
Hmmmmmmmmmmmm. Does that mean that KDE 4 does more than KDE 3 and uses more memory, or that when comparing KDE 4 and KDE 3 doing the same things KDE 4 uses less memory.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Leo S on Wednesday 26/Mar/2008, @22:26
|
KDE4 uses more memory period.
The impact depends largely on the screen size. On my EeePC, an empty KDE4 session uses about 10mb more than an empty KDE3 session. On my work comp (1680x1050 display), the difference is much larger (~50 mb IIRC).
|
[
Reply To This | View ]
|
Re: Memory usage..
by Segedunum on Thursday 27/Mar/2008, @14:27
|
"On my EeePC, an empty KDE4 session uses about 10mb more than an empty KDE3 session. On my work comp (1680x1050 display), the difference is much larger (~50 mb IIRC)."
Unfortunately, measuring memory usagelike that, probably by just looking at top, is pretty meaningless.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Anon on Thursday 27/Mar/2008, @15:20
|
The "-/+ buffers/cache" row in the output of free -m is pretty meaningful, actually - assuming no swap is being used.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Leo S on Thursday 27/Mar/2008, @15:36
|
It is not meaningless at all, as long as you look at the line that subtracts the buffers/cache.
In fact, this is the most meaningful measure of memory for the user, because as a user I'm mostly interested in "How much memory do I have left for applications", and measuring total used memory gives that answer, without having to worry about complexities like how much of a process's used memory is shared.
|
[
Reply To This | View ]
|
Re: Memory usage..
by Segednum on Saturday 29/Mar/2008, @15:55
|
"It is not meaningless at all, as long as you look at the line that subtracts the buffers/cache.
In fact, this is the most meaningful measure of memory for the user"
It doesn't means what you think it means at all. Read this:
http://ktown.kde.org/~seli/memory/desktop_benchmark.html
The readings for top don't give you any real indication of your memory usage at all.
"In fact, this is the most meaningful measure of memory for the user, because as a user I'm mostly interested in "How much memory do I have left for applications""
You're not going to get anything accurate from top or free. This has been discussed before.
|
[
Reply To This | View ]
|
Re: Memory usage..
by xyzzzz on Sunday 30/Mar/2008, @06:53
|
"http://ktown.kde.org/~seli/memory/desktop_benchmark.html"
I wonder whether the higher memory consumption of GNOME is simply caused by GTK's double buffering and not by out-of-process applets etc...
|
[
Reply To This | View ]
|
Re: Memory usage..
by Anon on Sunday 30/Mar/2008, @06:59
|
GTK doesn't double-buffer, IIRC. Qt4 does, though, with a correspondingly large increase in memory consumption.
|
[
Reply To This | View ]
|
Re: Memory usage..
by xyzzzz on Sunday 30/Mar/2008, @07:22
|
"GTK doesn't double-buffer"
I thought it does double buffering since GTK+ 2.0 (released 10 years ago)?
|
[
Reply To This | View ]
|
Re: Memory usage..
by Leo S on Sunday 30/Mar/2008, @12:19
|
I'm well aware of this page and have read it.
What you don't understand is that I'm not even remotely interested in exact memory usage. I don't care if the value that free reports is +- 10%. Free may not be the most accurate, but it's not random. The values correlate with memory usage, and it's pretty clear that KDE4 uses more. I could remeasure with exmap, but I would get the same conclusion so I really don't care.
|
[
Reply To This | View ]
|
|
The Fine Print: The previous
comments are owned by whomever posted them.
( Reply )
|
|