Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize fontification by avoiding recalculating a constant regexp #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kisaragi-hiu
Copy link

Implements / fixes #8.

regexp-opt can be slow because it also tries to optimize the regexp. For example:

(regexp-opt (list "aaa" "abb"))
;; -> "\\(?:a\\(?:aa\\|bb\\)\\)"

So it shouldn't be run every time a fontification happens.

This does mean that when lisp-extra-font-lock-loop-keywords-with-var and lisp-extra-font-lock-loop-keywords are changed, the changes would only take effect after the file is reloaded. This shouldn't be a problem though, as these variables are not meant to be changed, and are unlikely to be changed anyways.

regexp-opt can be slow because it also tries to optimize the
regexp. For example:

    (regexp-opt (list "aaa" "abb"))
    ;; -> "\\(?:a\\(?:aa\\|bb\\)\\)"

So it shouldn't be run every time a fontification happens.

This does mean that when
lisp-extra-font-lock-loop-keywords-with-var and
lisp-extra-font-lock-loop-keywords are changed, the changes would
only take effect after the file is reloaded. This shouldn't be a
problem though, as these variables are not meant to be changed, and
are unlikely to be changed anyways.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Memory consumption
1 participant