#389476 xterm: ansi color slows scrolling down

Package:
xterm
Source:
xterm
Description:
X terminal emulator
Submitter:
Date:
2022-02-14 00:36:02 UTC
Severity:
minor
Tags:
#389476#5
Date:
2006-09-25 22:22:45 UTC
From:
To:
Package: xterm
Version: 210-3
Severity: minor


I've noticed that there is a considerable slowdown in scrolling speed
when lines contain ansi-color codes that change the background (!)
colour.

This slowdown is hardly noticeable on a reasonably fast machine, but
on my trusty old toshiba libretto (only 266 Mhz, but I'll never part
with it) listing a directory with 200 files with ls --color=yes is
unbearably slow.

This must have crept in a few updates ago, I can't remember scrolling
being that slow on the laptop before. It's not fixed in 210-3.1
(tested on the laptop, uses same distribution and software, but
neomagic display hardware) and not in upstream (220) either.

The following loop in a bash tests that behaviour:

bogomips=`grep bogomips /proc/cpuinfo|tail -1|cut -f2 -d:|cut -f1 -d.`; wallclock=`date +%s`;i=0; while [ $i -lt $bogomips ]; do echo -e "\033[47m$i\033[00m"; i=$(($i + 1)); done; echo $((`date +%s` - $wallclock)) seconds

Outputs numbers up to $bogomips with white background. Will take about
10 seconds on my athlon 550 at home and the machines at work (intel
2800 mhz), and about 55 seconds on my laptop. I assume something
causes additional sluggishness on the laptop (maybe the display
driver? There's an old bug at
https://bugs.freedesktop.org/show_bug.cgi?id=1877 which might be
related).

The slowdown only happens when the background colour is changed, so if
you change the first escape sequence in the echo string to e.g.
"\033[31m" (red foreground) the whole loop takes about 1 second.

Also there is no slowdown in rxvt, on any machine.

I think this should probably be forwarded to upstream but I'd like it
to be in the debian BTS nonetheless.

Finally I manage to hit a bug that is actually reproducible! :)

Kind regards
     Friedel

#389476#10
Date:
2006-12-01 01:36:21 UTC
From:
To:
I think this is due to the way xterm is managing graphic contexts,
and have in mind a way to improve that (perhaps in xterm #224).

#389476#15
Date:
2009-08-09 22:03:44 UTC
From:
To:
I've made some improvements since #210 (about 30%, for the GC caching
which I referred to in the last item).  Any further improvements would
do what rxvt does - simply do not output changes to the screen (there are
pros/cons for that).

#389476#20
Date:
2011-11-22 21:37:30 UTC
From:
To:
Hi,

Xterm is still *really* slow for me when background colors are set;
it's if jump-scrolling is disabled.  For example:

$ time xterm -geometry 80x25 -e 'for i in `seq 1 10000`; do echo -e "This is line \e[40;31;01m$i\e[0m" ; done'

real    0m23.052s
user    0m1.396s
sys     0m1.148s

$ time xterm -geometry 80x25 -e 'for i in `seq 1 10000`; do echo -e "This is line \e[31;01m$i\e[0m" ; done'

real    0m0.781s
user    0m0.400s
sys     0m0.116s