From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Mickey Petersen <mickey@masteringemacs.org>
Cc: 70108@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: bug#70108: 29.1.90; `defalias' and `current-load-list'
Date: Mon, 01 Apr 2024 12:40:27 -0400 [thread overview]
Message-ID: <jwv7chh2ghb.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87cyr9ayb6.fsf@masteringemacs.org> (Mickey Petersen's message of "Mon, 01 Apr 2024 16:34:08 +0100")
>> Duplicate entries sounds like a bug (unless there are two calls to
>> `defalias` for the same function name within the same file).
>> Do you have a reproducible recipe that shows this?
> That is exactly the scenario. There's a setup function that gets
> called, which in turn sets up the defaliases. Each test would then end
> up calling this setup function, which would result in the same file
> foo.el calling defalias multiple times for things it has already
> defined.
Ah, OK, so it sounds like a misfeature in your code which should
presumably avoid doing the setup repeatedly.
[ As opposed to the case where those "duplicate" definitions end up
defining the functions differently. ]
Good. That means that you can easily work around the current
performance problem.
> Still, I find it a bit odd that it's *that* slow.
How slow are we talking about?
Have you tried `M-x profiler-start RET RET` and then later
`M-x profiler-report RET`?
In the absence of a reproducible recipe, I'd be interested to see where
the time is spent.
> We're talking hundreds, not millions, of entries.
You mentioned 600, so if there's the usual O(N²) behavior, that quickly
gets us to 100K territory which can be slow enough to be noticeable.
> As I mentioned earlier, I do not think it's a bug, but it caught me
> out, so I figured I'd at least ask.
It does sound like a performance bug, tho (triggered by an undesirable
behavior in your code).
We fixed a similar problem in `defvar` in the past.
>>>> This variable can easily get overrun with identical entries if the
>>>> inattentive programmer does not check if it is already bound.
>> Hmmm... I'm beginning to wonder: do your `defalias` happen while loading
>> a file, or do they happen more "dynamically"?
> The file is loaded once as part of the batch emacs process to run the
> tests, and unless there's some ert shenanigans I'm not familiar with,
> I do not think so.
But are the problematic `defalias` performed while loading the file
that defines the tests, or doing the execution of those tests.
That affects for example whether those function definitions end up
appearing in `load-history` as belonging to the file or belonging to
"unknown".
Stefan
prev parent reply other threads:[~2024-04-01 16:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-31 15:34 bug#70108: 29.1.90; `defalias' and `current-load-list' Mickey Petersen
2024-03-31 15:46 ` Eli Zaretskii
2024-04-01 14:58 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-01 15:34 ` Mickey Petersen
2024-04-01 16:40 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
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=jwv7chh2ghb.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=70108@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=mickey@masteringemacs.org \
--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).