Repository navigation
Improve generation scaling and memory use (#139) - #143
Merged
Merged
Conversation
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.
Summary
Closes #139.
Improve generation scaling for large project graphs and templates that inspect thousands of declarations while producing relatively little output. This includes the earlier indexing/caching work, the follow-up CodeModel laziness, memory-lifetime fixes, bounded performance diagnostics, regression tests, and the Buildalyzer logger correction.
The changes apply the same lazy-adaptation approach as the reporter's performance branch, with additional project/template indexing and cache-lifetime work. Local comparisons used that branch at
614de06, not the reporter's private solution.What changed
Lazy CodeModel adaptation and lifetime
Type/Classdefault collections andClass.Type, preserving virtualinitproperties and explicit initializers, including null.Countdoes not create adapters, short-circuit traversal only creates visited items, and empty collections skip deferred machinery.Type/TypeValue. Capture mapping settings at the existing construction boundary; retain eager behavior for customSettingsand public enumerable constructors.Project and metadata scaling
Template and rendering scaling
Diagnostics, build, and documentation
TYPEWRITER_TRACE_PERFwith request-local metadata stages, bounded per-template render summaries, planning/writing/formatting times, and clearly labelled process-wide allocation/GC observations.ad40feb, published onfix/typewriter-logger-restore-imports. Separate the full-framework logger's restore/build evaluations so restored package targets load on the first build, resolving theSystem.ValueTupleconflict without suppressing warnings or changing package versions.perf-opt.mdwith measurements, comparison limits, reproduction details, and remaining work.Comparison with the reporter's branch
The attribute-heavy probe uses 13,563 classes, four attributes per class, nested type references, five helper-filter templates, and 977 declarations sharing one source path. The metadata probe uses the real 9,275-file fixture through a supplied loader, excluding MSBuild. Focused results are medians from three rotating fresh-process runs per variant; MB is decimal.
This is not an across-the-board speed or peak-memory win:
origin/masterbaseline.For the same supported
Models.tstCLI workload, all variants produce the independently expected 464 files with matching original hashes:These are one sample per mode, not interchangeable repetitions. The already optimized pre-laziness snapshot took 29.03 s in the write sample, so the CLI results do not establish a reliable overall speedup.
The reporter branch produces only 467 of 931 expected outputs on the full five-template fixture because all 464 inline-predicate-only
Others.tstoutputs are missing. That older branch's full-fixture timing is therefore not equivalent work. The shared-template comparison supplements, rather than replaces, this PR's unchanged 931-output compatibility gate.The reporter's private, mostly
net48solution was not available. These syntheticnet10.0measurements must not be presented as reproducing its reported gains. Buffer/cache-capacity limits remain unchanged; restore, diagnostics, source generators, and project references were not disabled.Validation
Local validation used serial MSBuild (
-m:1 -nr:false) and isolated--artifacts-pathoutputs so the running language server was not stopped or its locked outputs overwritten. Raw probes/logs remain in ignored local artifacts; the recorded results and remaining-work plan are inperf-opt.md.