diff options
| author | Stefan Monnier | 2021-01-08 19:59:16 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2021-01-08 19:59:31 -0500 |
| commit | 29c7f8c915c3889dfd5b25878aa0692f826cd38f (patch) | |
| tree | 50eebd6fdd68eff7398f4d20c040c17752cd9933 /lisp/progmodes/python.el | |
| parent | 6e73e07a6f5cbdd1c5ae6e0f3fbd0f8f56813f1a (diff) | |
| download | emacs-29c7f8c915c3889dfd5b25878aa0692f826cd38f.tar.gz emacs-29c7f8c915c3889dfd5b25878aa0692f826cd38f.zip | |
* lisp/emacs-lisp/cl-macs.el: Optimize self-calls in tail position
Implement a limited form of tail-call optimization for the special
case of recursive functions defined with `cl-labels`. Only self-recursion
is optimized, no attempt is made to handle more complex cases such a mutual
recursion.
The main benefit is to reduce the use of the stack, tho in my limited
tests, this can also improve performance (about half of the way to
a hand-written `while` loop).
(cl--self-tco): New function.
(cl-labels): Use it.
* lisp/subr.el (letrec): Optimize single-binding corner case.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs--labels): Add tests
to check that TCO is working.
Diffstat (limited to 'lisp/progmodes/python.el')
0 files changed, 0 insertions, 0 deletions