cider icon indicating copy to clipboard operation
cider copied to clipboard

Add buffer-local caching to friendly-session calculation

Open vemv opened this issue 11 months ago • 2 comments

Friendly session calculation has always be at least a touch slow (ref, ref), and even more so following recent additions to it.

All slow paths have in common that they run seq-find over a series of sequences (the classpath, classpath roots, the ns list). Those can be arbitrarily large.

We may do relatively expensive stuff for each element, like trying to match a string.

So, this PR adds buffer-local caching.

The buffer-local caching is essentially this map:

<repl buffer> -> <is this buffer considered friendly to it?>

There are timestamps to ensure that we're not basing the caching on stale data.


From a quick test, it appears to work. Anyway I'll keep this as a draft to give it at least a couple days of QAing. Review welcome!

vemv avatar Sep 13 '23 07:09 vemv

I'll retake this PR after we get to address https://github.com/clojure-emacs/cider/issues/3468 - otherwise not cool to further touch this area with a release around the corner

vemv avatar Sep 17 '23 15:09 vemv

Might be a good time to revisit this for the next minor release.

bbatsov avatar Oct 31 '23 10:10 bbatsov