Repository navigation
perf(compile): faster discovery, scope visibility and warm writes - #930
Merged
Merged
Conversation
Group declarations by scope and owner once per scope lookup so a resource's visible declarations come from owner and ancestor lookups instead of classifying every declaration. Compile callers only need the identities of inaccessible declarations, so they use a resolver that skips per-pair inaccessible reasons. The full resolver keeps its output.
…vely Discovery queried the project tree with dozens of recursive globs per compile: once per declaration kind, once per layout validator, and once per resource category. A discovery pass now reads each directory listing once into a scoped snapshot that answers every glob with pathlib's matching and symlink semantics, memoizes the declaration facts and group layout, and classifies scoped-tree membership once per directory. The snapshot lives only for one pass, so later passes see current files. MODEL headers are matched by an exact native equivalent of the possessive header pattern in one batch call.
…y folders Warm writes compared every compiled artifact with a stat followed by a separate read; they now open each file once. The stale-file walk tried to remove every compiled directory and relied on failing rmdir calls for non-empty ones; it now removes only folders left empty by pruning, with the same result. Unchanged artifacts keep their bytes and mtimes.
The format page said a model described by [defaults] passes the description check, but [defaults] rejects description with D001. Project configuration now documents that each model uses only its nearest matching path default, that path defaults are not merged, and how to describe models when a broad "**" key coexists with more specific keys.
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.
Why
Profiling 0.133.0 showed discovery walking the project tree about 40 times per compile, scope visibility checking every resource against every declaration (11x more calls from 3k to 10k models), and warm writes doing a stat plus a read per artifact and trying to remove thousands of non-empty folders. The docs also implied
[defaults]could describe models and didn't say that only the nearest path default applies (CHI-441 phase 2).Changes
[defaults]wording.Verification
Path.rglobon random trees with links, the native header matcher against the regex on fuzzed input, and real-CLI write and prune tests.make test,make check-ci.