-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
tab-completing formula names is very slow #20
Comments
They were already unusably slow but I think maybe it got even worse? |
Oh, it's scanning Library/Formulas which is a symlink to the core tap now, and then it scans all the taps, so it's ~twice as bad as it used to be. |
also i'm pretty sure the algorithm used for taps is quadratic in the number of formulas |
This was very fast before all core formulae were moved to a separate core tap. Now it's very slow. Just compare to brew-cask completion, which takes just a moment to complete formula name. |
@pavelrad Casks are also in a tap so there's a bug here we'll need help fixing. |
Why this issue is closed? It's definitely not fixed yet. |
@pavelrad Because it's less slow than it was. |
In my subjective experience it's now much faster than it was before the split! I don't know why we're seeing different things. |
No, it is not fixed at all. It used to take a couple hundred milliseconds. It now takes 3-5 seconds of one of my 3.2GHz Xeon cores maxed out at 100% utilization. Performing tab completion in brew actually makes my fans spin up. I am not sure what the exact mechanism is yet, but the issue is homebrew core being a tap. That's what is causing the unacceptably poor tab completion performance. It's not the aliases, nor is it having to look through stuff twice (Formula, AND the tap). It's just the fact that is there at all. If you remove the Formula alias in If you move the Formula directory out of the homebrew tap and anywhere else, then create a new symlink to it in the |
I figured out the problem. We're getting differing results because some of us have an old completion script for homebrew that is getting loaded in addition to the new one. Everyone, check your One removed, the speed issues immediately go away while all completions continue to work. You probably will want to open a fresh shell to test. And @tdsmith is right, the brew bash completion script appears to have been optimized, so anyone who had an unpolluted bash_completion.d directory (bash_completion automatically loads everything in that directory) would see exactly what @tdsmith sees: a slightly faster brew tab completion. The old completion scripts do some things that result in very inefficient completion if there are a large number of formulae in a tap. Before the split, this was fine, as there would not be a huge number of formulae there. Now however, having 3500 Formulae in the taps folder makes the old completion script basically unusable. I have no idea how or why those old files are there, but I think its just a case of a tiny detail getting overlooked. Man, I am so happy to have my completions back. Fast as ever now! |
Great! Removing 'brew_bash_completion.sh' really helped with this issue, thank you, @metacollin. |
@pavelrad @metacollin Glad to hear it. We could/should perhaps have Homebrew remove them for you. |
Yes, that would be nice to have some automatic cleanup of these old scripts. |
Thirded. |
Any idea where to put this? I could imagine this being a (very lightweight) new check in |
@UniqMartin Feels like the sort of cleanup |
Didn't think of it, but this sounds like the right place. I'm still a bit hesitant to automatically delete stuff in |
I think we've actually taken more extreme measures previously: Lines 81 to 84 in 0123e04
|
There's also the Probably paranoid, but would we want to replace it with a zero-length file in case someone's shell profile sources it without checking for existence so we don't break their terminal? |
We'd have to move it out of the directory, but I generally like the idea of moving files instead of wiping them. The question here would be where to move them to? Do we want to introduce the equivalent of
I think in this case it's better to break the profile, so that it can be fixed. The error message will be sufficiently descriptive and if people come to us with that error, we'll know what to do. If too many issues are created after doing this (I hope not), we can still create a dummy file (with a comment that it's obsoleted by |
It's worth noting that uninstalling bash completion (either the actual package or from within homebrew) removes a large number of scripts from But, I think that someone might sourcing that file directly without doing file test is actually a pretty valid concern, I've seen a lot of people who do some pretty terrible things in the name of 'ricing' their shell, like aliasing cp to call rsync, or having But, noting what I said in the first paragraph, we could simply overwrite the file with an empty one, thus solving the problem without causing Mr. or Mrs. Unfortunate Bastard (and their baby kittens) a very bad day. An even safer option might be to only do that if it is unchanged from the original homebrew-legacy script (this would need to be a manual check I think - but it could just pull it in from github or a gist to do the check), and if there are changes, move it elsewhere, symlink it into |
Am out & about, so will give more feedback later, but one quick thing to be aware of: "bash completion" can mean two things in Homebrew land. There's (There's a similar issue with The stuff about leaving user modifications alone to "bash_completion" might be from Will give this a close reading and feedback later tonight. |
This has been improved as much as it will be for now. If this is still broken for you: we'll accept PRs for this but we're not actively working on it at this time. |
Please follow the general troubleshooting steps first:
brew update
and retried your prior step?brew doctor
, fixed as many issues as possible and retried your prior step?Bug reports:
tab-completion of formula names is very slow (many seconds), after updating to brew 0.9.9. I only have the core tap installed.
I'm actually unsure if these completions were already slow before, as I hadn't triggered one for a while before this latest update.
The text was updated successfully, but these errors were encountered: