From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70108: 29.1.90; `defalias' and `current-load-list' Date: Mon, 01 Apr 2024 12:40:27 -0400 Message-ID: References: <87h6gmbek2.fsf@masteringemacs.org> <8634s6be0x.fsf@gnu.org> <87cyr9ayb6.fsf@masteringemacs.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32805"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 70108@debbugs.gnu.org, Eli Zaretskii To: Mickey Petersen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 01 18:41:20 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rrKil-0008LL-TR for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Apr 2024 18:41:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rrKiV-0003Qy-8Z; Mon, 01 Apr 2024 12:41:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rrKiR-0003QP-VA for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2024 12:40:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rrKiR-0008FW-Mp for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2024 12:40:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rrKiU-00064x-Dv for bug-gnu-emacs@gnu.org; Mon, 01 Apr 2024 12:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Apr 2024 16:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70108 X-GNU-PR-Package: emacs Original-Received: via spool by 70108-submit@debbugs.gnu.org id=B70108.171198964623329 (code B ref 70108); Mon, 01 Apr 2024 16:41:02 +0000 Original-Received: (at 70108) by debbugs.gnu.org; 1 Apr 2024 16:40:46 +0000 Original-Received: from localhost ([127.0.0.1]:51467 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rrKiD-00064C-7t for submit@debbugs.gnu.org; Mon, 01 Apr 2024 12:40:46 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:32609) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rrKi9-00063v-VA for 70108@debbugs.gnu.org; Mon, 01 Apr 2024 12:40:43 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 67C5680BC1; Mon, 1 Apr 2024 12:40:32 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1711989629; bh=3OlTyXxlxGSl+aBOrmdr+uzc4WRP1KUeMc0za2lwcZ4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=YKNwrVhYlHpNrewkbzbj0EMtiusaCmQQ6sh41I68DN7XC5PujovJAlZ/XgQ7OP9iT ezkUcfdw59utviyHZlOWvwO8XsTiOYrKOXL7o6na4dNHmCmCKdHK6h7P3a1fJcBD12 mKtr25fTUcstjZSCFIv6GKwwH37E++Pq22hHCSpW9Y5jbRhv0JVNbcO3hOnSIQ2Uj2 Sf5cDe+8urewkUy+D2AMDsESNAWuOO6vFVz/toIFeS4vA5TBypeEEX652vTD3q1Nra KDfF0cxujSJmFJ23MB+n2Mo+bPLTwHxUysbY5pSdNxlCLPqwyyV6gwV5Eqk2VaT/Dm A/PE0MsU+3myw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5E89780919; Mon, 1 Apr 2024 12:40:29 -0400 (EDT) Original-Received: from alfajor (unknown [45.72.201.215]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2F32412059D; Mon, 1 Apr 2024 12:40:29 -0400 (EDT) In-Reply-To: <87cyr9ayb6.fsf@masteringemacs.org> (Mickey Petersen's message of "Mon, 01 Apr 2024 16:34:08 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:282484 Archived-At: >> 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=B2) 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