diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2024-06-03 13:26:10 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2024-06-03 13:40:39 -0400 |
commit | 16fc5b6c0c72464a75d9a84b754375662b3acec6 (patch) | |
tree | 88bc6831578e836df2d68389d2b2f3c3cb64a674 /lisp/emacs-lisp/inline.el | |
parent | eb9afd558ec506f1d349dbb61668d6231fda136f (diff) | |
download | emacs-16fc5b6c0c72464a75d9a84b754375662b3acec6.tar.gz emacs-16fc5b6c0c72464a75d9a84b754375662b3acec6.tar.bz2 emacs-16fc5b6c0c72464a75d9a84b754375662b3acec6.zip |
pcase.el (\`): Try and handle large patterns better
Large backquote patterns tend to lead to very large and deeply
nested expansions, but they also tend to contain a lot of
"constant" subpatterns that can be compiled to quote patterns.
This patch does just that. See discussion at
https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg01140.html
* lisp/emacs-lisp/pcase.el (pcase--split-pred):
Improve the handling of pred-vs-quote so it also works with
quoted objects like cons cells, vectors, and strings.
Simplify the `pcase--mutually-exclusive-p` branch accordingly.
(pcase--expand-\`): New function, extracted from the \` pcase macro.
Make it recurse internally, and optimize backquote patterns to `quote`
patterns where possible.
(\`): Use it.
* test/lisp/emacs-lisp/pcase-tests.el (pcase-tests-vectors): Add tests
that were broken by a more naïve version of the optimization.
(pcase-tests-quote-optimization): New test.
Diffstat (limited to 'lisp/emacs-lisp/inline.el')
0 files changed, 0 insertions, 0 deletions