Skip to content

perf(projects): precompute folder path parts for project/package lookup - #162

Merged
pfitzseb merged 2 commits into
mainfrom
sp/project-for-file-splitpath
Jul 25, 2026
Merged

perf(projects): precompute folder path parts for project/package lookup#162
pfitzseb merged 2 commits into
mainfrom
sp/project-for-file-splitpath

Conversation

@pfitzseb

Copy link
Copy Markdown
Member

derived_package_for_file and derived_project_for_file re-split every
candidate project folder for every file, and re-split the file path itself
once per candidate inside the filter closure. On a workspace with ~2200 Julia
files across ~360 project folders that is ~1.6 M splitpath calls (each a
regex match per path component), ~20% of a cold full-workspace analysis
sweep.

Split the folder paths once per revision in two new derived functions
(derived_package_folder_parts, derived_project_folder_parts), keep them
sorted deepest-first, and reduce the per-file lookup to one splitpath plus
a scan for the first prefix match. Deepest-folder-wins semantics are
unchanged; ties are impossible because equally deep prefixes of the same path
are the same folder.

find_project_for_file was a copy of the same logic and is replaced by
derived_project_for_file.

Cold sweep on that workspace: 41.0 s / 18.0 GiB -> 27.8 s / 11.5 GiB, and
splitpath no longer registers in the profile.

pfitzseb and others added 2 commits July 24, 2026 21:07
…pace)

Startup, time-to-first-analysis, and runtime measurements of the language
server on a 4362-file / 134-environment workspace, with profiles of the
cold sweep, per-keystroke path, and publish sweep, plus observed dynamic-
feature pathologies and ranked follow-ups.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
`derived_package_for_file` and `derived_project_for_file` re-split every
candidate project folder for every file, and re-split the file path itself
once per candidate inside the filter closure. On a workspace with ~2200 Julia
files across ~360 project folders that is ~1.6 M `splitpath` calls (each a
regex match per path component), ~20% of a cold full-workspace analysis
sweep.

Split the folder paths once per revision in two new derived functions
(`derived_package_folder_parts`, `derived_project_folder_parts`), keep them
sorted deepest-first, and reduce the per-file lookup to one `splitpath` plus
a scan for the first prefix match. Deepest-folder-wins semantics are
unchanged; ties are impossible because equally deep prefixes of the same path
are the same folder.

`find_project_for_file` was a copy of the same logic and is replaced by
`derived_project_for_file`.

Cold sweep on that workspace: 41.0 s / 18.0 GiB -> 27.8 s / 11.5 GiB, and
`splitpath` no longer registers in the profile.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@pfitzseb
pfitzseb merged commit f99d63b into main Jul 25, 2026
20 checks passed
@davidanthoff
davidanthoff deleted the sp/project-for-file-splitpath branch July 30, 2026 16:45
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