Fork me on GitHub
#cursive
<
2024-03-17
>
p-himik22:03:25

One of my pet peeves is how slow the search is for fully qualified keywords that have a short name, e.g. :. https://clojurians.slack.com/archives/C0744GXCJ/p1620125961298700?thread_ts=1620088501.297700&amp;cid=C0744GXCJ makes it apparent why it happens. But is there really no way to make it faster? I assume that such a search already takes into account only Clojure-related file types. But maybe it can be improved further?

cfleming02:03:53

No, I don’t think there is, unfortunately. The reason is that in the.long.namespace.name, that keyword could be referred to as ::key. I’ll double check the related-file types filtering - that filtering is actually not done for vars since they can be reference from Java code using the Clojure API, but I don’t think that makes sense for keywords so perhaps that might help.

p-himik08:03:38

Probably won't help you much, but I'd feel slightly guilty without putting it out there. :) There are three syntax ways to refer to the same keyword: 1. :a.b.c/k 2. (ns a.b.c) ::k 3. (ns whatever (:require [a.b.c :as x])) ::x/k (or :as-alias) So it seems that searching for :a.b.c/k as a keyword can be split into three separate threads, at least conceptually: 1. Search for the :a.b.c/k string, check that it's indeed a keyword (and not a part of a ; comment or a string or something else) 2. Search for the ::k string, check that it's a keyword like above, check that the namespace is a.b.c 3. Search for the /k string, check that it's preceded by ::valid-id, check that valid-id is an alias for a.b.c Of course, having a proper keyword-aware index would be even better, but I have no clue whether IDEA makes it feasible. However, those three steps that can be run in parallel already sound better than "search for k, check every result for being the :a.b.c/k keyword"

onetom14:03:26

buy an Apple M1 Max or M2 Pro with 32GB RAM at least or some very latest gen Intel i9 or AMD Ryzen machine, if u don't mind fan noise. that will noticably speed things up, IF you are on some mid-range consumer-grade machine at the moment :) also make sure no background processes are wasting any CPU cycles or memory. even if they do very little, but regularly, it can invalidate CPU caches, which might be perceived as intellij being sluggish.

p-himik14:03:08

That is definitely not a solution I'm looking for.

😄 1