gnome-terminal performance
[Somehow I managed to not write here for quite a while. In the meanwhile, I passed another birthday. Twenty-three now.]
That gnome-terminal is damn slow is not news, but I found a silly simple test case to measure how things are going. The test case:
time for x in `seq 10000`; do echo {a,b,c,d,e}{A,B,C,D,E}; done
With no write at all (>/dev/null):
real 0m1.436s
user 0m1.428s
sys 0m0.004s
with xterm (80x46, 10x20 bitmap font):
real 0m5.282s
user 0m1.384s
sys 0m0.032s
with xterm minimized (same settings):
real 0m4.472s
user 0m1.652s
sys 0m0.088s
with gnome-terminal (80x46, same visual size as 10x20, Bitstream Vera Sans Mono 12):
real 0m23.708s
user 0m1.388s
sys 0m0.048s
with gnome-terminal minimized (same settings):
real 0m2.833s
user 0m1.800s
sys 0m0.068s
To test the minimized case, just do a sleep 3 before the line and minimize the window after pressing enter.
Now that gives something to optimize for! Note how gnome-terminal's pseudo-terminal emulation is in fact faster than xterm's, since when minimized, g-t is faster. All we need is a hero to rip off some 50% of that rendering time to start with...
Update:with gnome-terminal (80x46, 10x20 bitmap font):
real 0m4.126s
user 0m1.848s
sys 0m0.088s
with xterm using xft (same Bitstream Vera Sans Mono 12, run by
uxterm -fa 'Bitstream Vera Sans Mono' -fs 12
):
real 0m27.334s
user 0m1.444s
sys 0m0.036s
Moreover, if I resize the windows to 80x4:
with gnome-terminal (Bitstream...):
real 0m7.480s
user 0m1.884s
sys 0m0.088s
with xterm using xft (Bitstream...):
real 0m26.638s
user 0m1.408s
sys 0m0.024s
Observations:
- xterm using xft starts flickering badly after a couple seconds.
- gnome-terminal is generally faster than xterm, when using the same font.
- gnome-terminal is far faster than xterm with smaller windows. Don't know why xterm's speed does not depend on the size of the window!
- gnome-terminal with xft rendering a bitmap font is still faster than xterm rendering the same bitmap font using X core protocol.
- Some people suggested that the scrollbar of gnome-terminal is taking a lot of time updating. I removed the scrollbar, with no change. It may be that it's still creating and updating the widget but not rendering. Somebody should look into that.
- Some other people suggested that federico's pango patch should change things, or genrally attributed the slowdown to pango. Pango is not involved here at all.
- Apparently the slowdown comes from Xft rendering the antialiased glyphs.
- Somebody suggested that copying opaque glyphs around when the background is a solid color should help. It should.
- Apparently gnome-terminal is much more important an application that I thought. Many many people are suffering from it's rather poor performance.
- Somebody should run a profiler to see what's going on. Guess they better wait for xorg 7.0 or they need an specially compiled X server to be able to profile inside it.
- g-t and vte are unmaintained these days. Seems like there are at least a few (if not a lot of) performance patches hanging around the bugzilla. Somebody should really standup and take maintainership. If nobody else does in a few days, I'm afraid I have to go for it.
- What else? Ah, Lorenzo requested a performance list to be created for GNOME. We will have some fun there.
Something funny that I experienced during these tests: My laptop's CPU would get to 70C and automatically drop the frequency to 1.2GHz (from 2.4GHz.) Thanks to the CPU Frequency Scaling Monitor applet, I figured that out, instead or reporting bogus digits. In the mean time, flipped the Vaio on the table such that it gets some more air. Have to open it for cleanup again, but it's really showing its age. Needs another backlight too. After getting a new laptop, I may use the old one for some
Wacky laptop tricks.