Closed daanturo closed 1 year ago
I guess one of the reasons requiring `f-shortdoc' is it generates some results displayed in the shortdoc.
Is there any use case of f' where this difference is actually significant? If
f' takes only 2ms to load instead of 0.5ms, this
shouldn’t be too much of an issue.
-- Lucien “Phundrak” Cartier-Tilet
https://phundrak.com (Français)
https://phundrak.com/en (English)
Sent from GNU/Emacs
It's actually slower than reported than above, because f-shortdoc
pulls shortdoc.el
when f.el
is loaded, especially the when not noninteractive
.
With s, dash, already loaded. f, f-short, shortdoc aren't in an noninteractive session.
(benchmark-progn (require 'f-shortdoc))
> Elapsed time: 0.0040120s
(benchmark-progn (require 'f))
> Elapsed time: 0.000744s
Same conditions, interactive session:
Elapsed time: 0.043350s
Elapsed time: 0.010676s
shortdoc.el
should only be loaded when shortdoc-display-group
is called to avoid being loaded just for a rarely called command.
I think upstream should make define-short-documentation-group
lazier. But currently IMO instead of this:
(when (version<= "28.1" emacs-version)
(require 'f-shortdoc))
We should:
(eval-after-load 'shortdoc
'(require 'f-shortdoc))
By trying this, I shaved the time taken to load f.el
on my machine from ~0.055s to ~0.034s. Although the linter may complain about the usage of eval-after-load
.
Contact Details
No response
Expected behavior
Loading
f.el
on Emacs 28+ shouldn't be slower than older versionsActual behavior
Requiring the uncompiled "f-shortdoc" make loading "f.el" ~3 times slower.
Just using an newer version of Emacs makes startup a bit slower doesn't sound right.
f.el version
master
Emacs version
master
Relevant code or log output