It's widely accepted that Gnome and KDE are the heaviest Unix desktops, while Xfce is lighter and faster. Yet many accuse Xfce of piling on the pounds in recent releases, and debates rage on as to whether Gnome or KDE is the king of the memory munchers. So we've gathered together some extensive benchmarks to find out the real story.
A desktop environment (DE) is not a window manager (WM) - the latter is a program which only draws and manages all the windows on your screen. A desktop environment is a homogeneous collection of tools, from window and file managers to hardware configuration utilities and (theoretically) any other application you may ever need. "Homogeneous" means that all pieces share the same base libraries and design guidelines, reusing interfaces (eg the file selector) and communicating with one another in various ways, from copy and pasting to opening a browser whenever you click on a URL.
For our tests we used the desktops packaged in Fedora 9 (this article was written just before Fedora 10 was released): Gnome 2.22.3, KDE 4.1.2 and Xfce 4.4.2. Our test machine was a dual-core AMD 64 3800+ system with 2 GB of RAM.
We created a separate user account with default settings for each DE and then ran the top command, with the $HOME/.toprc configuration file of Listing 8 (at the bottom of this article), and took several measurements. Eventually, all measurements of the same type were combined in one listing. You can read the definitions of the parameters in each listing in the top man page. Here, for brevity, we'll just note that RES is supposed to give you an idea of how much physical RAM an application is actually using. Stats can vary from system to system, so RES is not a laser-focused and exact indication of RAM usage - view these numbers as ballpark figures for a general idea of how much memory a desktop uses.
The questions we asked are:
The most notable facts are that KDE is relatively slow to start and Xfce, while not the fastest, takes much less space on disk than its competitors.
Listing 1: Startup time, number of packages and disk usage for each DE:
Startup time # of packages Total Size (MB)
Gnome: 11s 268 ~200 MB
KDE: ~22s 138 335 MB
Xfce: 14s 20 30 MB
Xfce also has the lightest file manager, Thunar:
Listing 2: File Manager displaying home directory (RES column is most important):
PID VIRT RES SHR S %CPU %MEM SWAP CODE DATA
GNOME (Nautilus): 2602 500m 72m 12m S 1.0 3.7 428m 1280 152m
KDE (Dolphin): 2852 339m 20m 14m S 10.9 1.0 319m 416 5852
XFCE (Thunar): 2671 254m 10m 8100 S 0.7 0.6 244m 528 32m
The load mentioned in the next lists consisted of showing (S) and then copying (C) a folder containing 1642 JPEG pictures, occupying a total of 3.6GB:
Listing 3: File managers under load (RAM):
VIRT RES SHR S %CPU %MEM SWAP CODE DATA COMMAND
GNOME (Nautilus): S 681m 202m 12m R 98.7 10.4 478m 1280 331m
GNOME (Nautilus): C 718m 233m 12m D 17.6 12.0 485m 1280 368m
KDE (Dolphin): S 385m 33m 16m S 18.6 1.7 351m 416 16m dolphin
294m 32m 7528 R 95.6 1.7 262m 44 24m kio_thumbnail
KDE (Dolphin): C 388m 36m 16m S 13.6 1.9 351m 416 20m dolphin
242m 6592 3844 D 10.0 0.3 236m 44 2444 kio_file
242m 6208 3844 S 9.6 0.3 236m 44 2036 kio_file
XFCE (Thunar): S 429m 25m 9972 S 0.3 1.3 403m 528 182m
XFCE (Thunar): C 431m 28m 12m S 33.2 1.5 403m 528 182m
Listing 4: File manager under stress (times):
Show Copy
GNOME (Nautilus): 2m55s 3m27s
KDE (Dolphin): 2m50s 3m38s
XFCE (Thunar): 2m46s 3m45s
Thunar was the lightest on RAM, while Dolphin was terribly slow and memory hungry both to display thumbnails and copy files. The leanest text editor is Xfce's Mousepad, while the terminal emulators have all more or less the same requirements.
Listing 5: Text Editor
PID VIRT RES SHR S %CPU %MEM SWAP CODE DATA
GNOME (gedit): 2748 320m 14m 10m S 2.3 0.7 305m 616 3704
KDE (kwrite): 2820 354m 22m 16m S 1.7 1.2 331m 4 5496
Xfce (mousepad): 2742 170m 7712 6012 S 0.7 0.4 163m 72 1608
Listing 6: X terminal
PID VIRT RES SHR S %CPU %MEM SWAP CODE DATA
GNOME (gnome-terminal): 2863 333m 13m 9772 S 1.0 0.7 320m 256 13m
KDE (konsole): 2800 349m 15m 10m S 1.0 0.8 334m 4 78m
Xfce (xfce4-terminal): 2719 244m 12m 8888 S 1.0 0.6 232m 152 3460
There are several facts, both technical and not technical, to take into account in order to understand the meaning of the listings. First of all, if you have enough RAM to run all the programs you need without swapping, every DE may feel adequately fast. This is especially true because what often slows down a desktop is the X server (about 30MB before you even log in) and the user programs you run. For instance, a spreadsheet with thousands of columns and complicated formulas, a program which leaks memory, or a web portal full of JavaScript and Flash are all do more to degrade performance than the DE.
Moreover, end user programs and DE basic components interact with each other in nasty, mysterious ways which may even differ from distro to distro. If desktop A uses twice as much RAM as desktop B just by waiting for you to touch the keyboard, this may be because it has already loaded all the shared libraries that, say, your favourite email client needs. In such a case, writing and reading email may require less memory and swapping, and will therefore be faster, on desktop A. Other things that can make numbers less reliable are whether (and how much) an application uses threads, or the average size of the files you load in it: these are all things which may increase the usage of swap and make your computer much less responsive. Of course, if a desktop needs to dip into swap just to start up, you need to make the most effective use of your RAM - eg a slick window manager like Blackbox or its derivatives.
So lastly, here's a summary chart of the three desktops in their idle states, showing the RAM usage of their main components:
Listing 7: Idle desktop memory usage (RES column is most important)
PID VIRT RES SHR S %CPU %MEM SWAP CODE DATA COMMAND
GNOME:
2386 135m 38m 8280 S 1.0 2.0 96m 1688 30m Xorg
2598 193m 9024 7112 S 1.3 0.5 184m 540 1780 metacity
2725 323m 12m 9104 S 1.3 0.7 310m 256 13m gnome-terminal
2572 332m 9m 7716 S 0.3 0.5 322m 36 22m gnome-settings-
2600 323m 15m 10m S 0.3 0.8 307m 544 4280 gnome-panel
2588 213m 2244 1232 S 1.0 0.1 210m 164 820 gnome-screensav
KDE:
2400 169m 43m 5940 S 4.3 2.2 125m 1688 37m Xorg
2820 354m 22m 16m S 1.7 1.2 331m 4 5496 kwrite
2646 284m 16m 13m S 1.3 0.9 267m 4 3944 kwin
2800 349m 15m 10m S 1.0 0.8 334m 4 78m konsole
2662 517m 28m 16m S 0.7 1.5 488m 4 105m plasma
2698 295m 9980 8192 S 0.3 0.5 285m 4 1408 klipper
2760 213m 7776 5988 S 0.3 0.4 206m 4 1032 kded
XFCE:
2395 136m 25m 8456 S 1.2 1.3 110m 1688 16m Xorg
2661 213m 2528 1512 S 0.3 0.1 210m 164 816 gnome-screensaver
2665 293m 5032 2588 S 0.3 0.3 289m 16 12m xfce-mcs-manager
2742 170m 7712 6012 S 0.7 0.4 163m 72 1608 mousepad
2666 179m 7300 5800 S 0.3 0.4 172m 288 1324 xfwm4
2673 232m 9460 6884 S 0.3 0.5 222m 104 2472 xfce4-panel
2682 244m 8792 6288 S 0.3 0.4 235m 44 12m xfce4-mixer-plugin
Final stats: So from this chart, the total RAM usage for Gnome's main components is 85MB, the total for KDE is 140MB, and for Xfce it's 66MB. As mentioned, these are the results from one set of tests - results will vary from distro to distro, and are affected by many factors such as the optimisation flags used to build the software. It's important that these figures aren't analysed too deeply, but instead seen as a roundabout approximation of Linux desktop memory usage.
We conclude this article with an invitation: copy the top configuration file of Listing 8 in your home directory, start your favourite apps, run top and then paste in a comment here its output, together with your Linux distribution, CPU type and amount of RAM. Let's see who can do more with less!
Listing 8: $HOME/.toprc
RCfile for "top with windows" # shameless braggin'
Id:a, Mode_altscr=0, Mode_irixps=1, Delay_time=3.000, Curwin=0
Def fieldscur=AEHIOQTWKNmbcdfgjPlRSuvyzX
winflags=62777, sortindx=10, maxtasks=0
summclr=1, msgsclr=1, headclr=3, taskclr=1
Job fieldscur=ABcefgjlrstuvyzMKNHIWOPQDX
winflags=62777, sortindx=0, maxtasks=0
summclr=6, msgsclr=6, headclr=7, taskclr=6
Mem fieldscur=ANOPQRSTUVbcdefgjlmyzWHIKX
winflags=62777, sortindx=13, maxtasks=0
summclr=5, msgsclr=5, headclr=4, taskclr=5
Usr fieldscur=ABDECGfhijlopqrstuvyzMKNWX
winflags=62777, sortindx=4, maxtasks=0
summclr=3, msgsclr=3, headclr=2, taskclr=3
Your comments
Post new comment