Skip to content

Memory consumption #8

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

Open
lockie opened this issue Nov 27, 2019 · 7 comments · May be fixed by #11
Open

Memory consumption #8

lockie opened this issue Nov 27, 2019 · 7 comments · May be fixed by #11

Comments

@lockie
Copy link

lockie commented Nov 27, 2019

Hello.
Thanks for awesome package! It makes editing lisp code so much better.
However, I have a slight problem with it: increased memory consumption. Before installing this package my emacs was eating around 600M RSS, after it could easily hog 2+G and start lagging because of GC (I'm using gcmh).
I'm using Emacs 26.3 on Gentoo.
Here's excerpt from memory profiler report for about 15 minutes of editing of common lisp buffer:

- command-execute                                       2,756,429,579  49%
 - call-interactively                                   2,756,367,291  49%
  - byte-code                                           2,578,698,232  46%
   - evil-operator-range                                2,578,696,120  46%
    - evil-read-motion                                  2,575,207,678  46%
     - evil-keypress-parser                             2,575,207,678  46%
      - read-key-sequence                               2,575,198,174  46%
       - apply                                          2,575,198,174  46%
        - ad-Advice-read-key-sequence                   2,575,198,174  46%
         - #<subr read-key-sequence>                    2,571,450,510  46%
          - timer-event-handler                         2,568,112,445  46%
           - apply                                      2,568,106,109  46%
            - jit-lock-stealth-fontify                  2,434,370,447  43%
             - jit-lock-fontify-now                     2,434,311,311  43%
              - jit-lock--run-functions                 2,434,310,255  43%
               - run-hook-wrapped                       2,434,310,255  43%
                - #<compiled 0x180200d>                 2,434,310,255  43%
                 - highlight-indent-guides--guide-region 2,148,061,990  38%
                  - font-lock-fontify-region            2,148,030,558  38%
                   - font-lock-default-fontify-region   2,148,030,558  38%
                    - font-lock-fontify-keywords-region 2,148,021,150  38%
                     - lisp-extra-font-lock-match-loop-keywords 2,147,945,702  38%
                      - regexp-opt                      2,147,944,678  38%
                       - regexp-opt-group               2,147,934,118  38%
                        - regexp-opt-group              2,147,890,422  38%
                         - regexp-opt-group             2,121,422,362  38%
                          - regexp-opt-group            2,077,157,205  37%
                           - regexp-opt-group           2,030,865,186  36%
                            - regexp-opt-group          1,917,640,794  34%
                             - regexp-opt-group         1,799,798,720  32%
                              - regexp-opt-group        1,666,424,752  29%
                               - regexp-opt-group       1,553,692,520  27%
                                - regexp-opt-group      1,436,092,136  25%
                                 - regexp-opt-group     1,323,165,412  23%
                                  - regexp-opt-group    1,058,357,452  19%
                                   - regexp-opt-group     905,951,944  16%
                                    - regexp-opt-group    777,148,543  13%
                                     - regexp-opt-group   670,963,739  12%
                                      - regexp-opt-group   582,616,420  10%
                                         regexp-opt-group   341,428,356   6%
                                         mapcar           222,950,392   4%

Is there something I can do to mitigate this issue?

@Lindydancer
Copy link
Owner

Lindydancer commented Nov 27, 2019 via email

@lockie
Copy link
Author

lockie commented Nov 27, 2019

Could you give it a try and let me know if it solves your problem?

Yeah sure. How do I do that? (sorry, my elisp hacker skills are somewhat lacking)

@Lindydancer
Copy link
Owner

Lindydancer commented Nov 27, 2019 via email

@lockie
Copy link
Author

lockie commented Nov 27, 2019

All right, I'll devote some time later to try that.
You're welcome!

@lockie
Copy link
Author

lockie commented Nov 29, 2019

Okay, so the call to regexp-opt seems to be the source of the problem. I've factored it out in the following ugly way:

@@ -576,6 +577,10 @@
                                                       "with")
   "List of `cl-loop' named variable binding parameters.")

+(defvar lisp-extra-font-lock-loop-keywords-regex
+  (regexp-opt (append
+               lisp-extra-font-lock-loop-keywords-with-var
+               lisp-extra-font-lock-loop-keywords)))

 ;; Match named loop keywords, and (optionally) any bound variables.
 ;;
@@ -592,9 +597,7 @@
                    (concat
                     "\\_<"
                     "\\("
-                    (regexp-opt (append
-                                 lisp-extra-font-lock-loop-keywords-with-var
-                                 lisp-extra-font-lock-loop-keywords))
+                    lisp-extra-font-lock-loop-keywords-regex
                     "\\)"
                     "\\_>")))))
     (condition-case nil

and the package seemed to keep working properly. After the whole day of several CL buffers being open and occasionally edited, the emacs's memory consumption is at record low 250M.

So I'm hoping some changes about that would hit master branch someday. Sorry I myself can't do it properly.

@Lindydancer
Copy link
Owner

Lindydancer commented Nov 30, 2019 via email

@lockie
Copy link
Author

lockie commented Nov 30, 2019

Thanks! Looking forward to it.

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 a pull request may close this issue.

2 participants