GNU bug report logs - #75358
[scratch/elisp-benchmarks] repeated runs don't apply selector

Previous Next

Package: emacs;

Reported by: Pip Cet <pipcet <at> protonmail.com>

Date: Sat, 4 Jan 2025 16:38:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 75358 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#75358; Package emacs. (Sat, 04 Jan 2025 16:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Pip Cet <pipcet <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 04 Jan 2025 16:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Pip Cet <pipcet <at> protonmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [scratch/elisp-benchmarks] repeated runs don't apply selector
Date: Sat, 04 Jan 2025 16:37:03 +0000
On scratch/elisp-benchmarks, the following emacs -Q invocation:

./src/emacs --batch -Q -l ./elisp-benchmarks/elisp-benchmarks.el --eval '(progn (elisp-benchmarks-run) (delete-other-windows) (elisp-benchmarks-run "bubble"))'

is equivalent to

./src/emacs --batch -Q -l ./elisp-benchmarks/elisp-benchmarks.el --eval '(progn (elisp-benchmarks-run) (delete-other-windows) (elisp-benchmarks-run))'

but

./src/emacs --batch -Q -l ./elisp-benchmarks/elisp-benchmarks.el --eval '(progn (elisp-benchmarks-run "bubble") (delete-other-windows) (elisp-benchmarks-run))'

is not.

(The (delete-other-windows) is necessary because of other issues).

The expected behavior is for the SELECTOR to determine the tests to be
executed, as described in the documentation; in reality, it merely
determines which tests are compiled, then all symbols matching the
regexp produced below are executed.

In the first example, the second SELECTOR argument has no effect,
because the tests to be run are determined as:

	           (mapatoms (lambda (s)
	                      (let ((name (symbol-name s)))
	                        (when (and (fboundp s)
	                                   (string-match
	                                    "\\`elb-\\(.*\\)-entry\\'" name))
	                          (push (match-string 1 name) names)))))

without respecting the SELECTOR argument in any fashion: any elisp
function that happens to match the symbol format is run.

"Fixing" this by applying the selector as a regular expression to the
"name" value seems simple enough, as a stop-gap.  But: IMHO, reserving
chunks of the symbol namespace for special uses is unsatisfactory and
should be avoided.  This is true in both interactive and
non-interactive emacs runs.  Running benchmarks in a live Emacs
session can be useful; running functions based on their symbol name
alone is dangerous.

Of course, the selector is currently applied to file names, not test
names, so we'd have to decide what (elisp-benchmarks-run "font-lock"),
for example, is supposed to do.

IMHO, the proper fix is to use a working test registration mechanism,
ideally ERT.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75358; Package emacs. (Mon, 06 Jan 2025 10:18:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs <at> gnu.org>
Cc: Pip Cet <pipcet <at> protonmail.com>, 75358 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#75358: [scratch/elisp-benchmarks] repeated runs don't apply
 selector
Date: Mon, 06 Jan 2025 05:17:04 -0500
Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:

> On scratch/elisp-benchmarks, the following emacs -Q invocation:
>
> ./src/emacs --batch -Q -l ./elisp-benchmarks/elisp-benchmarks.el --eval '(progn (elisp-benchmarks-run) (delete-other-windows) (elisp-benchmarks-run "bubble"))'
>
> is equivalent to
>
> ./src/emacs --batch -Q -l ./elisp-benchmarks/elisp-benchmarks.el --eval '(progn (elisp-benchmarks-run) (delete-other-windows) (elisp-benchmarks-run))'
>
> but
>
> ./src/emacs --batch -Q -l ./elisp-benchmarks/elisp-benchmarks.el --eval '(progn (elisp-benchmarks-run "bubble") (delete-other-windows) (elisp-benchmarks-run))'
>
> is not.
>
> (The (delete-other-windows) is necessary because of other issues).
>
> The expected behavior is for the SELECTOR to determine the tests to be
> executed, as described in the documentation; in reality, it merely
> determines which tests are compiled, then all symbols matching the
> regexp produced below are executed.
>
> In the first example, the second SELECTOR argument has no effect,
> because the tests to be run are determined as:
>
> 	           (mapatoms (lambda (s)
> 	                      (let ((name (symbol-name s)))
> 	                        (when (and (fboundp s)
> 	                                   (string-match
> 	                                    "\\`elb-\\(.*\\)-entry\\'" name))
> 	                          (push (match-string 1 name) names)))))
>
> without respecting the SELECTOR argument in any fashion: any elisp
> function that happens to match the symbol format is run.
>
> "Fixing" this by applying the selector as a regular expression to the
> "name" value seems simple enough, as a stop-gap.

Yep, as mentioned elisp-benachmarks was made (in order to give
meaningful results) to run from a known state, running two times will
not give meaningful results.  Anyway applying the selector to the runner
as well seems a satisfactory fix to me.

> But: IMHO, reserving
> chunks of the symbol namespace for special uses is unsatisfactory and
> should be avoided.  This is true in both interactive and
> non-interactive emacs runs.  Running benchmarks in a live Emacs
> session can be useful; running functions based on their symbol name
> alone is dangerous.
>
> Of course, the selector is currently applied to file names, not test
> names, so we'd have to decide what (elisp-benchmarks-run "font-lock"),
> for example, is supposed to do.

We can also decide to apply it only to test names to disambiguate if we
prefer.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75358; Package emacs. (Mon, 06 Jan 2025 10:18:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75358; Package emacs. (Mon, 06 Jan 2025 14:40:02 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Andrea Corallo <acorallo <at> gnu.org>
Cc: "Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs <at> gnu.org>, 75358 <at> debbugs.gnu.org,
 Pip Cet <pipcet <at> protonmail.com>
Subject: Re: bug#75358: [scratch/elisp-benchmarks] repeated runs don't apply
 selector
Date: Mon, 06 Jan 2025 09:39:06 -0500
>> The expected behavior is for the SELECTOR to determine the tests to be
>> executed, as described in the documentation; in reality, it merely
>> determines which tests are compiled, then all symbols matching the
>> regexp produced below are executed.

Originally, there was only one benchmark per file, so SELECTOR
selects the files.  Maybe we should simply always load all the files and
then use SELECTOR to select the `elb-*-entry` functions?


        Stefan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75358; Package emacs. (Mon, 06 Jan 2025 14:40:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75358; Package emacs. (Mon, 06 Jan 2025 20:36:02 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: "Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs <at> gnu.org>, 75358 <at> debbugs.gnu.org,
 Pip Cet <pipcet <at> protonmail.com>
Subject: Re: bug#75358: [scratch/elisp-benchmarks] repeated runs don't apply
 selector
Date: Mon, 06 Jan 2025 15:35:17 -0500
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>> The expected behavior is for the SELECTOR to determine the tests to be
>>> executed, as described in the documentation; in reality, it merely
>>> determines which tests are compiled, then all symbols matching the
>>> regexp produced below are executed.
>
> Originally, there was only one benchmark per file, so SELECTOR
> selects the files.  Maybe we should simply always load all the files and
> then use SELECTOR to select the `elb-*-entry` functions?

+1




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#75358; Package emacs. (Mon, 06 Jan 2025 20:36:02 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sun, 02 Mar 2025 04:12:03 GMT) Full text and rfc822 format available.

This bug report was last modified 105 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.