unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Michael Albinus <michael.albinus@gmx.de>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel@gnu.org
Subject: Re: master 695f679: Remove ; ; ; ###tramp-autoload cookie from Tramp defcustoms (Bug#47063)
Date: Fri, 26 Mar 2021 15:27:49 +0000	[thread overview]
Message-ID: <87mtuqaqa2.fsf@tcd.ie> (raw)
In-Reply-To: <878s6ba96u.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 25 Mar 2021 10:12:25 +0100")

[-- Attachment #1: Type: text/plain, Size: 2424 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>> Lars, any thoughts on how best to protect M-x from errors in
>> completion-predicate?  Is the following okay?
>
> [...]
>
>> +      (condition-case-unless-debug err
>> +          (funcall (get symbol 'completion-predicate) symbol buffer)
>> +        (error
>> +         (message "command-completion-default-include-p: %s: %S" symbol err)
>> +         nil))
>
> What's the performance impact here?  This is going to be called a whole
> bunch of times when the user hits TAB...

Compared to everything else going on around this, negligible.

Running the attached benchmark with

  emacs -Q -batch -f batch-byte-compile bench.el
  emacs -Q -l bench.elc

gives the following excerpts of timings:

  TAB RET
  bench-pred-expensive 1.804303 36 0.564483
  bench-pred-expensive 1.790578 35 0.551621
  bench-pred-expensive 1.777639 35 0.549471
  bench-pred-none      0.982336 35 0.550554
  bench-pred-none      0.980999 35 0.549281
  bench-pred-none      0.982774 35 0.550178
  bench-pred-old       0.834787 29 0.452026
  bench-pred-old       0.831663 29 0.450019
  bench-pred-old       0.830596 29 0.450292
  bench-pred-new       0.831019 29 0.450161
  bench-pred-new       0.831628 29 0.451437
  bench-pred-new       0.835570 29 0.452512

  e w w - TAB C-a C-k RET
  bench-pred-expensive 1.080096 30 0.413564
  bench-pred-expensive 1.078444 30 0.413685
  bench-pred-expensive 1.077938 30 0.414732
  bench-pred-none      1.003878 30 0.416143
  bench-pred-none      0.987872 30 0.413814
  bench-pred-none      0.991742 30 0.416257
  bench-pred-old       0.889184 25 0.343545
  bench-pred-old       0.889369 25 0.344027
  bench-pred-old       0.885496 25 0.343227
  bench-pred-new       0.901361 25 0.345625
  bench-pred-new       0.887233 25 0.344885
  bench-pred-new       0.889201 25 0.344515

Where bench-pred-new extends bench-pred-old with the suggested
condition-case-unless-debug in the "tight" loop.

> I'm also not quite sure why we should be ignoring these errors --
> they're code errors, like any others, and shouldn't be expected to
> fail, should they?

No, but code rarely listens to expectations ;).

Of course this use case isn't as critical/irreversible as
post-command-hook or process filters/sentinels, but the general notion
is similar: it would be nice if code errors didn't bork M-x completion.

-- 
Basil


[-- Attachment #2: bench.el --]
[-- Type: application/emacs-lisp, Size: 2186 bytes --]

  parent reply	other threads:[~2021-03-26 15:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210313133546.6042.78482@vcs0.savannah.gnu.org>
     [not found] ` <20210313133547.AA06C20B2E@vcs0.savannah.gnu.org>
2021-03-13 22:27   ` master 695f679: Remove ; ; ; ###tramp-autoload cookie from Tramp defcustoms (Bug#47063) Basil L. Contovounesios
2021-03-13 23:20     ` Stefan Monnier
2021-03-14  8:39       ` Michael Albinus
2021-03-14 12:59         ` Basil L. Contovounesios
2021-03-14 14:57           ` Stefan Monnier
2021-03-24 22:19             ` Basil L. Contovounesios
2021-03-25  8:25               ` Michael Albinus
2021-03-26 15:18                 ` Basil L. Contovounesios
2021-03-26 15:24                   ` Michael Albinus
2021-03-25  9:12               ` Lars Ingebrigtsen
2021-03-25 14:05                 ` Stefan Monnier
2021-03-26 11:28                   ` Lars Ingebrigtsen
2021-03-26 13:39                     ` Stefan Monnier
2021-03-26 14:42                       ` Michael Albinus
2021-03-26 18:39                         ` Basil L. Contovounesios
2021-03-26 15:36                       ` Basil L. Contovounesios
2021-03-26 16:37                         ` Stefan Monnier
2021-03-26 18:18                           ` Basil L. Contovounesios
2021-03-26 22:12                       ` Lars Ingebrigtsen
2021-03-26 15:57                     ` Basil L. Contovounesios
2021-03-26 15:33                   ` Basil L. Contovounesios
2021-03-26 16:32                     ` Stefan Monnier
2021-03-26 18:18                       ` Basil L. Contovounesios
2021-03-26 15:27                 ` Basil L. Contovounesios [this message]
2021-03-26 22:11                   ` Lars Ingebrigtsen
2021-03-27  1:18                     ` Basil L. Contovounesios
2021-03-27 12:33                       ` Lars Ingebrigtsen
2021-03-27 20:29                         ` Basil L. Contovounesios
2021-03-14 14:57         ` Stefan Monnier
2021-03-14 18:42           ` Michael Albinus
2021-03-14 20:30             ` Stefan Monnier
2021-03-15  9:00               ` Michael Albinus

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=87mtuqaqa2.fsf@tcd.ie \
    --to=contovob@tcd.ie \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    --cc=michael.albinus@gmx.de \
    --cc=monnier@iro.umontreal.ca \
    /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).