Re: [dev] [st] 0.3 release

From: Brandon Invergo <brandon_AT_invergo.net>
Date: Mon, 05 Nov 2012 11:45:09 +0100

> On 02.11.2012 20:12, Christoph Lohmann wrote:
>> * New drawing code, which is way more faster and comparable to the
>> other terminals out there.
>
> It totally is, and now im impressed. And a bit humbled, since i tried
> for some time for myself and failed ;)

It's still not perfect, but unfortunately I have had no time to look
into it at all lately. I have a good idea of where the problem is
though.

First, to see what I'm talking about:
1) Open a terminal and start some CPU monitor (ie top or htop)
2) Open another terminal and load a rather large man page (try
termcap(5))
3) Start scrolling down on the man page and watch your Xorg process's
CPU usage spike. Depending on how fast your computer is, this can be
anywhere from ~10%-75% CPU usage (15% on this quad-core Intel Core2Pro,
75% on my 800mhz Arm Cortex A8)
4) Try the same experiment with xterm or urxvt: no CPU spike

The problem is that in its drawing functions, st does *at least* one xlib call
per terminal line. When you factor in any change in text properties
(color, italics, etc), then you get even more xlib calls per line. When
you're scrolling, and thus redrawing the entire terminal repeatedly,
that adds up to a hell of a lot of library calls.

st is using the XftDrawStringUtf8. I was working on it before the
official switch to Xft, when it was still using some variety of
XlibDrawString. In that case, I was looking into XlibDrawText, which
allows drawing several strings with one Xlib call, but the problem is
that they all need to have the same text properties, which can be a
problem when you're using color shell output or source code
highlighting. So, I didn't have much luck with that. Plus, a cursory
search shows that Xft has no analogous function (is that true?).

I started working on it but like I said, I had to put it aside before I
could finish it and there is no way I can return to working on it
anytime soon, so hopefully this info could help someone else get started
and improve the rendering performance once and for all.

Anyway, congrats on the release!

Cheers,
Brandon
Received on Mon Nov 05 2012 - 11:45:09 CET

This archive was generated by hypermail 2.3.0 : Mon Nov 05 2012 - 12:00:06 CET