GNU bug report logs - #67536
29.1; Calc mode's math-read-preprocess-string conses unnecessarily

Previous Next

Package: emacs;

Reported by: Raffael Stocker <r.stocker <at> mnet-mail.de>

Date: Wed, 29 Nov 2023 21:32:02 UTC

Severity: normal

Found in version 29.1

Done: Mattias Engdegård <mattias.engdegard <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mattias Engdegård <mattias.engdegard <at> gmail.com>
To: Raffael Stocker <r.stocker <at> mnet-mail.de>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>, 67536 <at> debbugs.gnu.org
Subject: bug#67536: 29.1; Calc mode's math-read-preprocess-string conses unnecessarily
Date: Sun, 3 Dec 2023 11:43:07 +0100
2 dec. 2023 kl. 20.26 skrev Raffael Stocker <r.stocker <at> mnet-mail.de>:

> Is this the case? As ‘mapc’ is implemented directly in C and ‘dolist’
> falls back to ‘while’, I thought it would be the other way around.

It's the function calls that are expensive. `dolist` just expands to a loop.
It's even worse if the lambda expression accesses variables outside (which wasn't the case here) because that forces creation of a closure.

> However, I checked your proposed version and there is an issue with
> replacement of sub- and superscripts.

Look at that, I got the semantics wrong. Sorry about that. Here's a new patch.
A lot less pretty this time.

In any case, make sure to include unit tests in your final patch.

The whole problem is compounded by the public variables (math-read-replacement-list etc) that we somehow feel a need to keep unchanged just in case some user modifies them, despite this almost certainly never happens.





This bug report was last modified 1 year and 155 days ago.

Previous Next


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