-
-
Notifications
You must be signed in to change notification settings - Fork 45
Minor performance improvements #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Instead of calling `envrc--merged-environment' on each buffer setup, call it only once, after generating definitions with envrc, and cache the resulting process environment with `envrc--cache`. This saves needless variable formatting and merging and also allows buffers to share instances of `process-environment'.
Only update cache for the updated process-environment after calculating a new cache value. Previously, the update happened on each buffer setup. Remove use of pcase because cache values can never be nil.
Thanks! I committed a subset of this change: only updating the cache when necessary. But as for merging the full environment and putting it in the cache instead of merging it each time a buffer initializes, I prefer to keep things the way they are: the merged environments can be much larger - particularly if they already contained |
Benefits of
The last argument to
In the code you're making the explicit assumption that In my view, the optimization entails no added complexity and brings clear performance benefits. New commit
|
No,
Ah yes, true, I couldn't see why I had done it like that. Will revert. |
Going to have to think about this. The whole setup used to be much simpler, and then it ended up with additional complication in order to support buffer-local changes to |
Commit
Clear envrc--status on mode exit
is a minor correctness fix.The other two commits are strict performance improvements and don't change runtime behaviour.
Both changes apply to the hot path of setting up a new buffer before it's displayed to the user, which is always worth optiziming.
I've run these changes on my system for the last few weeks.
This package is a joy to use, thank you for sharing it!