Commit 1f5cdfc
committed
Speed up completion: tab-delimited wire format + two-tier cache
The vector-of-{:candidate :type :ns}-maps shape was costly to
decode on the warm-up: every candidate allocated an alist, every
:type a keyword, every :ns a string. Switch the default form to
emit a tab- and newline-delimited string ("name\tCODE\tns\n...")
and parse it with split-string + a tiny decode-row helper. The
Compliment / Orchard rich shape and the oldest newline-only
string still parse for backward compat.
On top of that, add a global core-cache: symbols from
port-completion-core-namespaces (just "clojure.core" by default,
configurable) are fetched once per session via the new
port-completion-core-form and never expire. Per-ns queries use
port-completion-local-form which filters those out server-side,
so each per-ns response is just the ns-local vars plus non-core
requires -- typically 10-100x smaller in projects that mostly use
clojure.core.
Two-tier mode auto-disables when port-completion-form is
customized away from the default (compared cheaply against a
pinned port-completion--default-form defconst), so the Compliment
override installed by port-enable-orchard keeps working. Refresh
manually via M-x port-completion-refresh-core.1 parent eff352c commit 1f5cdfc
3 files changed
Lines changed: 511 additions & 106 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 14 | + | |
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
| |||
0 commit comments