Fork me on GitHub
#cider
<
2024-04-06
>
kongra16:04:19

Hi. When running lein repl :headless :host 127.0.0.1 :port 7888 and cider-connecting to it, I'm observing a gradual degradation of my emacs gc performance. This degradation also worsens the overall emacs performance to the point of caret hiccups during source code editing. Running (garbage-collect) manually reports:

((conses      16 5948358 2145018) 
 (symbols     48   38825    1407) 
 (strings     32 2983633  354261) 
 (string-bytes 1        27167350) 
 (vectors     16           81894) 
 (vector-slots 8 2161338 2199718) 
 (floats       8     994    2718) 
 (intervals   56  741518    5027) 
 (buffers     984             23))

... done (0.320s)
Closing the cider-repl buffer solves the problem:
((conses      16 776188 3985051) 
 (symbols     48 38825     1407) 
 (strings     32 235051  116892) 
 (string-bytes 1        6535738) 
 (vectors     16          73567) 
 (vector-slots 8 2100295 946825) 
 (floats       8     853   2859) 
 (intervals   56    6263  20202) 
 (buffers    984             21))

... done (0.086s)
and makes emacs smooth again. It looks like it's about conses and string-bytes. The same behavior happens for ClojureScript projects. Emacs version 30.0.50, linuxmint 21. My gc settings:
(setq gc-cons-threshold    (* 80 1024 1024))
(setq gc-cons-percentage              0.33)
(setq read-process-output-max (* 1024 1024))
It's not a new problem for me; it got me to the point of using emacs with jemalloc like: LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so emacs --daemon This makes the overall experience a little better - the emacs process consumes much less memory (currently reaching 300 MB; previously, it could be even over 500). Does anybody here know what the issue may be about? Thanks in advance for any help.

vemv18:04:34

Anyway, how quickly does it degrade for practical purposes? Hours? Days?

kongra19:04:21

After an hour or two, it's already noticeable.

vemv19:04:37

Wow :o Does it happen even for a small, empty project?

kongra20:04:37

It happens for non-empty projects, but I haven't checked for (almost) the empty ones. Nevertheless, it looks like it isn't related to any whole-project static analysis. I don't use the language server. But I think (it's only my intuition) that it may have something to do with copying/pasting structures of Clojure code, or with flycheck analysis - I'm using flycheck with clj-kondo.

vemv09:04:50

You could try a 'bisect' by disabling flycheck and possibly other elements