Terminal Performance

A recent Slashdot post claimed that while gnome-terminal was slow, it wasn't nearly as slow as konsole. So I decided to benchmark the variety of terminals I have installed on my system, to see once and for all which terminal sucks the most.

The testing machine is an Athlon XP 2500 (Barton) with 1G of memory and an Nvidia Ti4200, running Gentoo Linux with kernel 2.6.5 and Xorg 6.7.0. Gnome and KDE are both installed. Since it's Gentoo, just about every program on the machine was compiled from source with CFLAGS="-march=athlon-xp -O2 -pipe -frename-registers -fomit-frame-pointer" using gcc 3.3. The terminals tested are:

For fairness in testing, the scrollback buffer in every terminal was set at 1000 lines. For gnome-terminal and konsole, both aliased and anti-aliased fonts were tested.

Please note that only the total running time is reported, since system and user times for X applications are not very meaningful.

Startup times

$TERM -e date
time for i in 0 1 2 3 4 5 6 7 8 9 ; do $TERM -e date ; done
    
terminaltime (seconds)
gnome-terminal3.060
konsole6.484
xterm1.247
Eterm2.316
aterm1.135

Output performance

The terminals were launched and then asked to output 8 million characters to the screen in the following two ways:
#include <stdio.h>
int main() {
 int i,j;
 for(i=0; i<10000; i++) {
  for(j=0; j<80; j++)
   printf("%c", (unsigned char)(rand()%74 + 48) );
  printf("\n");
 }
 return 0;
}
    
#include <stdio.h>
int main() {
 int i,j;
 for(i=0; i<15625; i++) {
  for(j=0; j<512; j++)
   printf("%c", (unsigned char)(rand()%74 + 48) );
  printf("\n");
 }
 return 0;
}
Note that in the first method, all 80 characters fit within one terminal line. For the second method, the terminal has to wrap lines.
terminal80-char line time (seconds)512-char line time (seconds)
gnome-terminal (antialiased)6.75042.963
gnome-terminal (aliased)6.34441.209
konsole (antialiased)1.71114.812
konsole (aliased)1.0777.734
xterm1.1293.704
Eterm0.3291.998
aterm0.3831.883
linux console0.4083.865

Memory usage

It is not an easy task to measure memory for an X program under Linux. For the sake of sanity, I only measured the sym of vmData, vmStk, and vmExe (a good indicator of how much non-shared memory the application uses) and vmLib (a good indicator of how much shared library code it loads) from the /proc tree.
terminalnewly started
((vmData+vmStk+vmExe) + vmLib) (MB)
after 80 000 characters
((vmData+vmStk+vmExe) + vmLib) (MB)
gnome-terminal4.7 + 14.54.7 + 14.5
konsole1.8 + 212.2 + 21
xterm1.1 + 3.71.1 + 3.7
Eterm0.8 + 5.21.2 + 5.2
aterm0.5 + 2.80.7 + 2.8
It appears that gnome-terminal and xterm, unlike the other terminals, preallocate the scrollback buffer when they are launched.

Conclusions

Aterm is damn fast, and doesn't use much memory either. Overall, it seems to be the winner. Eterm, despite the pretty graphics, is also very good. Xterm starts up instantaneously, but doesn't output data as efficiently as aterm or Eterm. The Linux console is reaonably fast, at least for 80 character lines, but remember that it has a very small scrollback buffer. Konsole and gnome-terminal, compared with their light-weight cousins, are slow, massive beasts. For konsole, we must note that it takes forever to start up (after all, it's loading 21 megabytes of shared libraries). Without line wrapping and with aliased fonts, konsole is as fast as xterm. However, line wrapping slows konsole down 7 times, and anti-aliased fonts slow it down 2 times. Gnome-terminal starts up reasonably fast, but its output rate is abysmal. The only good thing that can be said about it is that it doesn't depend much on whether fonts are anti-aliased or not.


Last modified: Wed Aug 4 14:11:56 EDT 2004