Subject: bug#78474: 31.0.50; Wrong char insertion in rxvt

From: Manuel Giraud <[email-masked]>
Date: Fri, 25 Jul 2025 09:24:33 +0200

Hi,

So test by running "emacs -Q -nw" into different terminals.  Each time,
I've used the following benchmark on "src/xdisp.c":
--8<---------------cut here---------------start------------->8---
(defun scroll-up-benchmark (iteration)
  (let ((oldgc gcs-done)
        (oldtime (float-time)))
    (condition-case nil (while t (scroll-up) (redisplay))
      (error (message "%d) GCs: %d Elapsed time: %f seconds"
		      iteration
                      (- gcs-done oldgc) (- (float-time) oldtime))))))

(defun do-run-bench ()
  (interactive)
  (dotimes (i 10)
    (goto-char (point-min))
    (scroll-up-benchmark i)))
--8<---------------cut here---------------end--------------->8---

Since this benchmark is sensible to the height (and maybe also width) of
the window, I've included those sizes.  Here are the results against
master and with my "no \t\b" patch:
--8<---------------cut here---------------start------------->8---
* master (e026b57f077)
** xterm -geometry 80x50
0) GCs: 567 Elapsed time: 31.086774 seconds
1) GCs: 5 Elapsed time: 4.949145 seconds
2) GCs: 4 Elapsed time: 4.838345 seconds
3) GCs: 4 Elapsed time: 4.846398 seconds
4) GCs: 4 Elapsed time: 4.863649 seconds
5) GCs: 4 Elapsed time: 4.847629 seconds
6) GCs: 4 Elapsed time: 4.870357 seconds
7) GCs: 4 Elapsed time: 4.886179 seconds
8) GCs: 4 Elapsed time: 4.845446 seconds
9) GCs: 4 Elapsed time: 4.837510 seconds

** vte --geometry=80x50
0) GCs: 564 Elapsed time: 31.275409 seconds
1) GCs: 5 Elapsed time: 4.507136 seconds
2) GCs: 4 Elapsed time: 4.391385 seconds
3) GCs: 4 Elapsed time: 4.423045 seconds
4) GCs: 4 Elapsed time: 4.414433 seconds
5) GCs: 4 Elapsed time: 4.392768 seconds
6) GCs: 4 Elapsed time: 4.426145 seconds
7) GCs: 4 Elapsed time: 4.366869 seconds
8) GCs: 4 Elapsed time: 4.383935 seconds
9) GCs: 4 Elapsed time: 4.415684 seconds

** alacritty -o "window.dimensions.columns=80" -o "window.dimensions.lines=50"
0) GCs: 564 Elapsed time: 32.297622 seconds
1) GCs: 6 Elapsed time: 4.696004 seconds
2) GCs: 3 Elapsed time: 4.545549 seconds
3) GCs: 4 Elapsed time: 4.557124 seconds
4) GCs: 4 Elapsed time: 4.552929 seconds
5) GCs: 4 Elapsed time: 4.569936 seconds
6) GCs: 4 Elapsed time: 4.569329 seconds
7) GCs: 4 Elapsed time: 4.596861 seconds
8) GCs: 4 Elapsed time: 4.579287 seconds
9) GCs: 4 Elapsed time: 4.583949 seconds

** OpenBSD console (120x33)
0) GCs: 571 Elapsed time: 40.368367 seconds
1) GCs: 7 Elapsed time: 8.152495 seconds
2) GCs: 6 Elapsed time: 7.554665 seconds
3) GCs: 6 Elapsed time: 7.984193 seconds
4) GCs: 6 Elapsed time: 10.279187 seconds
5) GCs: 6 Elapsed time: 10.023705 seconds
6) GCs: 5 Elapsed time: 9.566880 seconds
7) GCs: 6 Elapsed time: 9.344119 seconds
8) GCs: 6 Elapsed time: 7.759981 seconds
9) GCs: 6 Elapsed time: 8.756986 seconds

* no "\t\b" patch
** xterm -geometry 80x50
0) GCs: 566 Elapsed time: 28.977438 seconds
1) GCs: 5 Elapsed time: 4.128581 seconds
2) GCs: 4 Elapsed time: 4.028657 seconds
3) GCs: 4 Elapsed time: 4.034688 seconds
4) GCs: 4 Elapsed time: 4.041386 seconds
5) GCs: 4 Elapsed time: 4.023377 seconds
6) GCs: 4 Elapsed time: 4.031582 seconds
7) GCs: 4 Elapsed time: 4.048343 seconds
8) GCs: 4 Elapsed time: 4.033119 seconds
9) GCs: 4 Elapsed time: 4.035043 seconds
9) GCs: 4 Elapsed time: 4.035043 seconds

** vte --geometry=80x50
0) GCs: 564 Elapsed time: 28.069097 seconds
1) GCs: 5 Elapsed time: 3.822866 seconds
2) GCs: 4 Elapsed time: 3.711420 seconds
3) GCs: 4 Elapsed time: 3.725387 seconds
4) GCs: 4 Elapsed time: 3.750833 seconds
5) GCs: 4 Elapsed time: 3.719932 seconds
6) GCs: 4 Elapsed time: 3.718813 seconds
7) GCs: 4 Elapsed time: 3.706245 seconds
8) GCs: 4 Elapsed time: 3.722128 seconds
9) GCs: 4 Elapsed time: 3.734348 seconds

** alacritty -o "window.dimensions.columns=80" -o "window.dimensions.lines=50"
0) GCs: 564 Elapsed time: 28.864394 seconds
1) GCs: 5 Elapsed time: 3.953090 seconds
2) GCs: 4 Elapsed time: 3.857996 seconds
3) GCs: 4 Elapsed time: 3.862114 seconds
4) GCs: 4 Elapsed time: 4.039003 seconds
5) GCs: 4 Elapsed time: 3.855950 seconds
6) GCs: 4 Elapsed time: 3.849463 seconds
7) GCs: 4 Elapsed time: 3.856677 seconds
8) GCs: 4 Elapsed time: 3.871728 seconds
9) GCs: 4 Elapsed time: 3.868826 seconds

** OpenBSD console (120x34)
0) GCs: 571 Elapsed time: 32.808671 seconds
1) GCs: 7 Elapsed time: 10.445288 seconds
2) GCs: 6 Elapsed time: 9.432234 seconds
3) GCs: 6 Elapsed time: 8.429330 seconds
4) GCs: 6 Elapsed time: 8.490854 seconds
5) GCs: 5 Elapsed time: 8.528081 seconds
6) GCs: 6 Elapsed time: 9.435279 seconds
7) GCs: 6 Elapsed time: 8.696780 seconds
8) GCs: 6 Elapsed time: 8.993753 seconds
9) GCs: 5 Elapsed time: 7.756981 seconds

--8<---------------cut here---------------end--------------->8---

-- 
Manuel Giraud