Improve support of make autocompletion for huge Makefiles #63
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.
I noticed that if Makefiles become very large, bash completions becomes
very slow. To some degree that cannot be easily avoided, for instance, just the
call to make can take several seconds.
This patch is an attempt to improve the support of huge Makefiles as they are
generated by Automake. I do not expect that you merge it back as it is but
I thought it might be useful for others to see and play around with.
Maybe someone finds a less hacky solution to the underlying problem.
Anyway, here is the idea behind my changes:
If the files get too large (> 50000 lines of code in my example),
the calls to make and sed become very slow (make takes about 4 seconds
while sed takes up to 11 seconds, again in my example).
Additionally, there is a lot of noise in the recommendations.
I get about 2800 results, mostly uninteresting. Instead I am mainly
interested in the binaries or the test commands.
As a hack, I added a simple cache for expensive calls to make and sed, respectively.
I also filter away the search results referencing source files or intermediate files
like ".o" and ".obj" files, thus reducing the number of recommendations to 160.
In sum, it is a "work-for-me" solution, but what I rather want is to encourage a
discussion of a more thoughtful approach: