This is just a curious discovery I made while testing the urxvt

I ran this simple script, to print out 500,000 lines and timed it. Both the xterm and the urxvt have 20k scrollback buffers.

#!/usr/bin/perl use warnings; use strict; my $start = time; for (1..500000){ print "$_\n"; } my $end = time; my $diff = $end - $start; print "$diff\n";
To my utter amazement ( and I'm still wondering if it's an xterm bug), the xterm took a whopping 1067 seconds, while the urxvt only took 19 seconds.

I would be interested in hearing the results from other people, on their xterm speed, and maybe k-terminal, etc.

Anyone have clues as to why this occurs?


I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re: (OT) X terminal output speed on linux
by shmem (Chancellor) on Oct 16, 2006 at 15:45 UTC
    Well, the speed of xterm depends on various factors. Besides
    • graphics card
    • size of the terminal
    • state of the window - (partially/fully) obscured? iconified?
    • color/monochrome xterm?
    • font, font size

    it's the amount of scrollback that has most impact on performance.

    • Having a 83x68 xterm, fully visible, 5000 lines scrollback, the code needs 74 seconds to run.
    • Firing up the code and immediately iconifying the window reduces the time to 41 seconds.
    • Increase the scrollback to 1_000_000 and (besides consuming an insane amount of memory) xterm behaves like an old telex (I didn't wait for it to finish :-).
    • Reducing the scrollback to 0 results in 8 seconds execution time.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

      Also, xterm can use true type fonts not only X fonts (rxvt can only use X fonts) and these are much slower than X fonts.

        Both my xterm and urxvt used the default system font(i.e no -fn option specified), although I can't say for sure that they don't select different fonts, but they look the same.

        I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: (OT) X terminal output speed on linux
by Joost (Canon) on Oct 16, 2006 at 14:46 UTC
Re: (OT) X terminal output speed on linux
by Scott7477 (Chaplain) on Oct 16, 2006 at 15:18 UTC
    Slightly OT, but your test script piqued my interest so I ran it on my AS Perl 5.8.7 on my WinXP box and got a result of 34 seconds. Then I ran the script on the same box using Strawberry Perl alpha release 1 and got 34 seconds as well.

    Given that the link to the rxvt-unicode mentions that Perl is embedded in the terminal emulator, does that mean that you simply opened up the terminal window and entered something like "perl 578511.pl" to run the script?
Re: (OT) X terminal output speed on linux
by rhesa (Vicar) on Oct 16, 2006 at 15:23 UTC
    My gnome-terminal on ubuntu takes 8 seconds. default settings list 500 lines, 318KB scrollback.
Re: (OT) X terminal output speed on linux
by Anonymous Monk on Oct 16, 2006 at 15:32 UTC
    $ time perl -le 'print for 1..500000'
    gives about 5 seconds on my rxvt, 55 seconds for xterm, and 19 seconds for gnome-terminal. Both rxvt and xterm have 5000 lines of scrollback, gnome-terminal whatever is the default.