perf(dotfiles): cache aliases and read straight from file#1918
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, we'd rebuild all aliases from sqlite every single time the shell started. This is... ok?
But not great.
With more aliases, we get slower shell starts. On a new-ish macbook pro this isn't too bad, but I imagine it gets worse with older hardware, and especially spinning rust.
This PR builds aliases into cached files every time they are mutated - either locally, or from sync. From there, starting a new shell is pretty much just reading and printing a file.
I've also neatened up the store "building" code a bit
I'd like to follow up with removing the async runtime from the init path if possible, as that is adding overhead and isn't needed to read the cached file. If the cache doesn't exist, we can start tokio and build it.
There's some obvious duplication here that could be cleaned up. I decided that I'd rather leave it as-is, so that future dotfiles have a nice path to follow. While aliases are the same for posix shells, not everything will be
Checks