-
Notifications
You must be signed in to change notification settings - Fork 10
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
Cache compinit for 20h #8
Conversation
I like the idea of having some mechanism to update the dumpfile, as indeed we never allow it to be updated in the current code, as we always skip the check with |
Correct me if i'm wrong but currently if we add/remove completions we should zimfw clean (rm zdumpfile) the file, then do a login (which generates a new zdumpfile since we call it with -C) and then zimfw compile (to build .zwc) ? This change basically automates it by "forcing" to generate a new zdumpfile every 20h. Unlike what I say, it isn't a performance improvement. Every 20h we force a new zdumpfile (by calling w/o -C) which we should then zcompile it (we should probably zcompile it here in this PR). What do you think ? |
Yes, currently the only way to force compinit to dump a new configuration is to run As explained in the compinit documentation
I see a couple issues with the proposed solution:
But you raised a very good point, and I already have an idea on how to cover all scenarios during the usage of the zimfw tool, which also has the advantage of not being executed during start up. Will work on it soon. |
Benchmark with the default zimfw installation (from the develop branch as the time of writing this):
So impact is significant! (And benefit is debatable, as I pointed out in the previous comment.) |
I want do be able to install/delete/update packages on my machine without worrying if it needs to dump a new compinit. That is the problem I am trying to solve here. The 20h is a "daily" interval. Should probably be 24h. So I pay a 30ms penalty on the first daily login. It's acceptable imo. Every day I will call once without -C and then zcompile it. Do you automatically zcompile on login if .zwc doest exist or the respective zsh has changed ? |
Created a Instead of a check during shell startup with an arbitrary schedule (e.g. 20h), this runs after files are updated by zimfw (in the build, install and update actions). Only if a change in the number of completion functions or in the Zsh version is detected, then the dumpfile is removed in order to be dumped again in the next shell startup. |
Omit checking for new functions during 20h, see http:https://zsh.sourceforge.net/Doc/Release/Completion-System.html
I get a speed bump from 0.06s to 0.04s on zsh startup.
Don't know how this interacts with zimfw compile (we compile zcompdump). Code was taken from prezto/omz