Avoid per-keystroke dir-locals walk in the file source#201
Merged
Conversation
`helm-source-projectile-file's `filtered-candidate-transformer' runs on every input change and wrapped its body in `with-temp-buffer' plus `hack-dir-local-variables-non-file-buffer', which searches for a `.dir-locals.el' up the directory tree on each keystroke. Unlike the candidates function, the transformer never lists project files, so it never used those dir-locals - the temp buffer inherits `default-directory' either way, so `projectile-project-root' returns the same value. Drop the wrapper. Typing in large projects is noticeably snappier.
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.
helm-projectile-find-file's file source ran ahack-dir-local-variables-non-file-buffer(which walks the tree looking for.dir-locals.el) inside a temp buffer on every keystroke, even though the transformer never lists project files and so never used those dir-locals. Dropping the wrapper makes typing in large projects noticeably snappier;projectile-project-rootreturns the same value without it.A regression test asserts the transformer no longer touches dir-locals.
M-x checkdocwarnings