unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: antero@mailbox.org, 68234@debbugs.gnu.org
Subject: bug#68234: [PATCH] Increase blink-matching-paren-distance by 300kb.
Date: Fri, 05 Jan 2024 09:49:00 +0200	[thread overview]
Message-ID: <83frzcw783.fsf@gnu.org> (raw)
In-Reply-To: <CADwFkmkbyc1TioYHkAmg_MPpdzK3OEeAvyRVT5+zDtveYOD=GQ@mail.gmail.com> (message from Stefan Kangas on Thu, 4 Jan 2024 15:08:35 -0800)

> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Thu, 4 Jan 2024 15:08:35 -0800
> Cc: 68234@debbugs.gnu.org
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Do people feel okay with increasing this value by a factor of 4?  This
> > blinking is supposed to be very fast, so if this will slow down
> > display, it's not TRT.
> 
> I benchmarked this on my old ~2013 GNU/Linux machine using:
> 
>   (progn
>   (goto-char (point-max))
>   (insert "}")
>   (let ((minibuffer-message-timeout 0)
>         (blink-matching-delay 0)
>         (repeat 20) fst)
>     (dolist (distance (number-sequence 100 1000 100))
>       (let* ((blink-matching-paren-distance (* distance 1024))
>              (time (car (benchmark-run repeat (blink-matching-open)))))
>         (message "distance %-4dKB takes %-.3fs (x%.1f)"
>                  distance
>                  (/ time repeat)
>                  (/ time (setq fst (or fst time))))))))
> 
> In src/lisp.h (176 KB/5607 lines), I get:
> 
>   distance 100 KB takes 0.011s (x1.0)
>   distance 200 KB takes 0.015s (x1.3)
>   distance 300 KB takes 0.015s (x1.3)
>   distance 400 KB takes 0.015s (x1.3) *
>   [etc.]
> 
> In src/xterm.c (945 KB/32842 lines), I get:
> 
>   distance 100 KB takes 0.010s (x1.0)
>   distance 200 KB takes 0.017s (x1.6)
>   distance 300 KB takes 0.025s (x2.4)
>   distance 400 KB takes 0.034s (x3.3) *
>   distance 500 KB takes 0.042s (x4.1)
>   distance 600 KB takes 0.051s (x5.0)
>   distance 700 KB takes 0.060s (x5.8)
>   distance 800 KB takes 0.068s (x6.7)
>   distance 900 KB takes 0.078s (x7.6)
>   distance 1000KB takes 0.079s (x7.7)

Based on these times, I don't recommend raising the threshold above
200K.

> I also tried this in a ridiculous 23 MB header file that I found in the
> Linux kernel tree, which my Emacs opens in fundamental-mode:

I don't think Fundamental mode is relevant: everything is
lightning-fast there.  I would be interested in modes like Python,
though, if this is relevant for them.

> Humans can't perceive delays smaller than 100 ms

That's not true: 50 ms is already perceptible.  Moreover, this
particular time is an add-on to the redisplay time after cursor
movement, so adding even a few tens of msec could easily pass the
perception threshold.  And finally, some people, including on this
list, use machines older and much slower than those from 10 years ago.

> Of course, we could also double (instead of quadruple) this number, and
> get most of the benefits still.
> 
> Eli, do you have any preference?

I think we can at most double it at this time.  This is a defcustom,
so people can always increase it in their local configurations if they
have much faster machines and need routinely to cope with such large
parenthetical expressions.

> Note finally that the above examined files are unusually large (as is
> often the case in our tree).

What matters is not the size of the file, but the size of a
parenthetical expression.





  reply	other threads:[~2024-01-05  7:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03 18:37 bug#68234: [PATCH] Increase blink-matching-paren-distance by 300kb Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found] ` <handler.68234.B.170430710530123.ack@debbugs.gnu.org>
2024-01-03 18:48   ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-04 11:31     ` Eli Zaretskii
2024-01-04 23:08       ` Stefan Kangas
2024-01-05  7:49         ` Eli Zaretskii [this message]
2024-01-05 20:50           ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-05 21:10             ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-06  7:01             ` Eli Zaretskii
2024-01-06 12:09               ` Stefan Kangas
2024-01-09  5:56           ` Stefan Kangas
2024-01-04  4:50 ` Stefan Kangas
2024-01-04 19:22   ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-04 21:03 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-04 21:36   ` Antero Mejr via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83frzcw783.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=68234@debbugs.gnu.org \
    --cc=antero@mailbox.org \
    --cc=stefankangas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).