]> git.eshelyaron.com Git - emacs.git/commit
Calc: speed up math-read-preprocess-string (bug#67536)
authorMattias Engdegård <mattiase@acm.org>
Tue, 19 Dec 2023 16:10:42 +0000 (17:10 +0100)
committerMattias Engdegård <mattiase@acm.org>
Tue, 19 Dec 2023 16:11:07 +0000 (17:11 +0100)
commit7c1c2519167d51931a5d17f27529c8c8358c7c61
treec84fdbb1a6c00930cb8ba25e546b746fa7a4b42a
parentade814a2268285475675872760e3c358ec24a130
Calc: speed up math-read-preprocess-string (bug#67536)

`math-read-preprocess-string` is one of the bottlenecks of `calc-eval`
and was unnecessarily slow even with no substitutions made.
This affected org-mode in particular, where `calc-eval` is called
repeatedly to recalculate tables.

Reported by Raffael Stocker who also wrote the unit tests here.

* lisp/calc/calc-aent.el (math--read-preprocess-re-cache): New.
(math-read-preprocess-string):
Use math--read-preprocess-re-cache, first computing it if necessary.
* test/lisp/calc/calc-tests.el (calc-math-read-preprocess-string):
New test.
lisp/calc/calc-aent.el
test/lisp/calc/calc-tests.el