perf: cache module flags in symbol plists
For small amounts of data, symbol plists are the most efficient (space and time wise) as data access gets in Emacs. Hash tables, though O(1), impose a minimum threshold of overhead before it becomes the efficient option, but this benefit won't be obvious for datasets of at least 60 or less. Since modulep! is used *a lot*, and used to determine a module's state (and state of its flags), there is a benefit to caching it. Still, this is only a read-only cache, and does not replace the `doom-modules` hash-table, which will always be the preferred interface for the rest of the module API.
This commit is contained in:
parent
7161f27bb3
commit
c5188c4388
2 changed files with 17 additions and 7 deletions
|
@ -47,6 +47,12 @@ hoist buggy forms into autoloads.")
|
|||
(cl-loop for var in doom-autoloads-cached-vars
|
||||
when (boundp var)
|
||||
collect `(set ',var ',(symbol-value var)))
|
||||
;; Cache module state and flags in symbol plists for quick lookup by
|
||||
;; `modulep!' later.
|
||||
(cl-loop for (category . modules) in (seq-group-by #'car (doom-module-list))
|
||||
collect `(setplist ',category
|
||||
(quote ,(cl-loop for (_ . module) in modules
|
||||
nconc `(,module ,(get category module))))))
|
||||
(doom-autoloads--scan
|
||||
(append (doom-glob doom-core-dir "lib/*.el")
|
||||
(cl-loop for dir
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue