Disable warmup of orchard.java caches #913
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After the recent improvements to
orchard.java
parsing machinery (which also included performance improvements), I find it no longer necessary to perform project-wide cache warmup for Java classes at cider-nrepl startup. The reasoning is below:orchard.java/class-info
has sufficient performance now, even when not yet cached. For example,(orchard.java/class-info 'clojure.lang.Compiler)
takes ~150ms on my machine. This delay is slightly noticeable during the firstcider-doc
, but this is one of the biggest Java classes (10k LOC). One of the biggest JDK classes, java.lang.Character, takes ~80 ms to be parsed. Also, when jump-to-definition is invoked, the waiting time is much more noticeable there because it is dominated by locating the source file in the archive, extracting, and presenting it to the user (Emacs side). The Clojure-side cache doesn't improve it much.orchard.java/class-info
contains invasive side-effects like loading all project-wide classes in the background, it led to issues in the past like orchard.java/class-info class initialization breaks JavaFX orchard#250,parser_utils/parse_java
taking a long time. orchard#240, and possibly orchard as dependency will cause problems with swing UI applications orchard#162 (not sure about this one, have to investigate further).So, I decided to remove the warmup for parsing Java classes. I was planning to remove the warmup code altogether, but then noticed that it claimed it warms up Compliment completions too which it doesn't. I decided that warming up one specific instance of Compliment completions (
.prefix
Java member completion) can be beneficial (it has a perceivable delay on first invocation) and is maximally non-invasive as much as I understand (it doesn't do any classloading and relies solely on classpath scanning). However, I also don't mind not including it and removing the warmup code completely, I'm not overly attached to the Compliment warmup.If we are to keep the warmup, I also want to replace
future
with an explicit Thread.start to avoid initializing Clojure's agent pool for the user.