Improving the performance of the popular Clojure development tool clojure-lsp
Blog post from Metabase
In an effort to enhance the performance of the Clojure development tool clojure-lsp, significant improvements were made to reduce its startup time and memory usage when handling large codebases, such as Metabase's. By examining heap memory issues and applying various optimizations, including increasing heap space, refining allocation techniques, and improving memoization, the tool's initialization time was halved and memory allocations reduced by two-thirds. The use of clj-async-profiler allowed for detailed profiling, which highlighted inefficiencies and informed the enhancements made, such as optimizing the deep-merge function and rewrite-clj library. These refinements, confirmed by benchmarks from clojure-lsp's maintainer Eric Dallo, have been incorporated into the tool's latest release, although further optimizations are possible to reduce memory usage even more.