perf(projects): precompute folder path parts for project/package lookup - #162
Merged
Conversation
…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>
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.
derived_package_for_fileandderived_project_for_filere-split everycandidate 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
splitpathcalls (each aregex 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 themsorted deepest-first, and reduce the per-file lookup to one
splitpathplusa 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_filewas a copy of the same logic and is replaced byderived_project_for_file.Cold sweep on that workspace: 41.0 s / 18.0 GiB -> 27.8 s / 11.5 GiB, and
splitpathno longer registers in the profile.