Use universal variables instead of temp files #76
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.
While setting up my prompt with fish_async_prompt I noticed that after adding multiple async functions it started getting noticable slow. After a bit of digging around I found that adding an additional async function adds around 80ms of execution time to
fish_prompt
:While having 1 function like this isn't really noticable as it is below 100ms, this starts adding up quickly and becomes really noticable, especially when the whole goal is to make the prompt faster with making it async.
I didn't dig deep enough to investigate why reading from temporary files make this process this slow, but quickly doing a proof of concept using universal variables instead showed a huge performance increase:
I've only tested it on my local setup (MacOS 13.2.1, fish 3.7.1), so I can't comment if this has unintended side effects on other systems, but since this variable handling is part of the shell itself I would presume no.