cider
cider copied to clipboard
Add buffer-local caching to friendly-session calculation
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!
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
Might be a good time to revisit this for the next minor release.