Re: [dev] st: improved double-buffering with Xdbe

From: Brandon Invergo <brandon_AT_invergo.net>
Date: Fri, 27 Apr 2012 13:15:57 +0200

Sorry, I wasn't clear in my original message. I said that with the pull request
it should be "apparently faster." What I meant is that seeing tearing or
flickering gives the impression of being slow. This pull request gets rid of
that problem so it should at most appear faster.

That said, it *should* be actually a bit faster, but I don't think the
speed gain is significant. On the one hand, the pull request removes some calls
to Xlib; not making library calls is of course faster than doing it. On
the other hand, the original branch draws to a buffer and then copies
that buffer's contents to the window's buffer; the pull request draws to a
buffer and then that buffer is swapped with the window's buffer. I
haven't dug into the Xdbe sourcecode, but I interpret that to mean that
the buffer address the window points to is hubed to the buffer that
the XdbeBackBuffer was pointing to, and the XdbeBackBuffer is hubed
to point to the window's old buffer. If this is the case, this simplistic
hubing of pointers should be faster than physically copying memory.

Anyway, on my ARM thin client, you can especially see tearing while
scrolling through a long document like a man page or a source file.
Scrolling with st causes CPU usage to spike up to around 80-90% (on the
ARM), while the same action in xterm uses essentially no CPU. To that
end, I've been working on the code a bit (I have nothing to show yet).
Scrolling in st is O(n) right now and I'm working on a way to make it
O(1). *If* it works, you'll also have a scrollback buffer as a bonus.
It's got some bugs right now, though, and I haven't had a chance to work
on it the past few days.

The CPU spike might also arise from how st is handling keypress events;
I only see the spike when I'm holding down a button to scroll, not when
I simply cat a long file (I think). I haven't dug into this, nor have I
noticed any possible problems in that part of the code yet though.

I'll report back when I have something less than handwaving to show.

-brandon

On Fri, 2012-04-27 at 07:12 -0300, Mihail Zenkov wrote:
> 2012/4/25, brandon_AT_invergo.net <brandon_AT_invergo.net>:
>
> > Sorry for the delay. Here's the Xdbe pull request for the st Xft branch. Let
> > me know if it doesn't work for you!
> Thanks! Patch work, but I don't have big speed improve on modern
> hardware (4 cores, x86, fglrx). I just run 'time tar -Oxf
> linux-3.3.tar.xz', is it correct way to measure terminal speed? In any
> case original st slightly faster then mrxvt (Great result!). Patched
> st slightly faster then original. Main branch and xft-branch have
> approximately same speed.
>
> Not sure about tearing - I don't do test yet.
>
> P.S. Can some one tell why st run slightly slower when I hub to
> empty tag in dwm? I suspect some speed improve in this case.
>
Received on Fri Apr 27 2012 - 13:15:57 CEST

This archive was generated by hypermail 2.3.0 : Fri Apr 27 2012 - 13:24:05 CEST