]> git.eshelyaron.com Git - emacs.git/commit
Make the docstrings-wide check 70x faster
authorMattias Engdegård <mattiase@acm.org>
Sat, 14 Oct 2023 09:42:44 +0000 (11:42 +0200)
committerMattias Engdegård <mattiase@acm.org>
Sat, 14 Oct 2023 10:15:33 +0000 (12:15 +0200)
commitfbbe40cf50ecd9f4ce5f2ff684190d8ed37f2aa9
treeb2a1db4a7216c07f728dbad665c3f05787c7963d
parent548bc3e3d18ea6776032ca83dafbc89e3ddb5a5a
Make the docstrings-wide check 70x faster

Instead of performing a number of expensive transformations on the
original doc string and then use a dynamically-created regexp to find
wide lines, step through the lines in the unmodified string and only
perform the transformations on lines that exceed the limit.
This is sound because the transformations are contractive.

The new check will usually not cons nor perform any regexp matching.

* lisp/emacs-lisp/bytecomp.el (bytecomp--docstring-line-width): New.
(byte-compile--wide-docstring-p): Cheaper implementation.
lisp/emacs-lisp/bytecomp.el