Skip to content

Avoid per-keystroke dir-locals walk in the file source#201

Merged
bbatsov merged 1 commit into
masterfrom
perf-file-source-transformer
Jul 1, 2026
Merged

Avoid per-keystroke dir-locals walk in the file source#201
bbatsov merged 1 commit into
masterfrom
perf-file-source-transformer

Conversation

@bbatsov

@bbatsov bbatsov commented Jul 1, 2026

Copy link
Copy Markdown
Owner

helm-projectile-find-file's file source ran a hack-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-root returns the same value without it.

A regression test asserts the transformer no longer touches dir-locals.

  • The commits are consistent with our contribution guidelines
  • The new code is not generating bytecode or M-x checkdoc warnings
  • You've updated the changelog
  • You've updated the readme (no user-facing behavior change)

`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.
@bbatsov bbatsov merged commit 307dae8 into master Jul 1, 2026
10 checks passed
@bbatsov bbatsov deleted the perf-file-source-transformer branch July 1, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant