Skip to content

Batch directory listings in project detection#2010

Open
bbatsov wants to merge 2 commits into
masterfrom
feature/detection-tramp-perf
Open

Batch directory listings in project detection#2010
bbatsov wants to merge 2 commits into
masterfrom
feature/detection-tramp-perf

Conversation

@bbatsov

@bbatsov bbatsov commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Follow-up to #2009 with the TRAMP perf work from that review. Two cache-miss hot paths in project detection were doing one file-exists-p per candidate; both now issue a single directory-files listing per directory, the same trick projectile--vcs-from-directory-listing already uses.

  • projectile-root-bottom-up: depth * markers round-trips up a deep tree become depth.
  • projectile-detect-project-type: dozens of stats across all registered types on first detection of a remote project become one.

Markers with a path separator fall back to file-exists-p, so nothing changes for debian/control and friends.

bbatsov added 2 commits June 12, 2026 09:42
projectile-root-bottom-up probed each directory level with one
file-exists-p per marker (9 stats per level with the default VCS list).
On a cache-miss walk up a deep tree over TRAMP that's depth*9 sequential
round-trips.

Probe each level with a single directory-files listing instead, the same
trick projectile--vcs-from-directory-listing already uses. Markers
carrying a path separator can't be answered from a basename listing and
fall back to file-exists-p. Factor the listing into a shared
projectile--directory-entry-set helper and reuse it in the VCS probe.
projectile-detect-project-type walked all 50+ registered types, each
running file-exists-p per marker file. On a remote project that's dozens
of sequential round-trips on the first detection.

List the project root once and answer plain-name markers from that
listing; markers carrying a path separator (debian/control, the bloop
settings file) fall back to file-exists-p. Threaded through an optional
entry-set argument on projectile-verify-file/projectile-verify-files so
existing callers are unaffected.
@bbatsov bbatsov force-pushed the feature/detection-tramp-perf branch from 8e928c6 to e9eff94 Compare June 12, 2026 06:43
@bbatsov bbatsov changed the base branch from feature/2008-disable-project-type to master June 12, 2026 06:43
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