Remove a waccess call when completing executables #9931
Merged
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.
When we run these completions, we have already run waccess with X_OK. We already know the file is executable.
There is no reason to check again.
Restores some of the speedup from the fast_waccess hack that was removed to fix #9699.
In my tests it's ~1.14x - if fish with c67d77f reverted takes 1x, this takes 1.2 times as long and fish right before this takes 1.37x as long. (vs 3.6.1 it's 1.22x reverted / 1.5x this / 1.7x master)
The absolute time difference will scale with the size of $PATH.
Note: This will conflict with any port of wildcard, like #9916. I would still like to merge this because it should be in 3.6.2 and offset some of the loss of #9699.
I'm aware that this adds another argument to an already argument-heavy function, but it's only called in one spot and I would leave that cleanup to after a port (a lazy "file information" object would be quite cool to have here, but might be awkward considering TOCTTOU issues, but at the very least the "stat_res" and "stat buf" arguments would just be some combined thing like an Option or Result).
TODOs: