Repository navigation
Speed up rewriting large test projects - #8
Merged
Merged
Conversation
The rewriter loaded the same five metadata references for every source file and processed files one at a time. On test projects with hundreds of files it took longer than the C# compiler itself. References are now loaded once and files are rewritten in parallel. The rewritten output is byte-for-byte the same.
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
On a large test project the SharpAssert rewrite step took longer than the C# compiler itself. For every source file the task loaded the same five metadata references again and built the semantic model, one file at a time. This PR loads the references once and rewrites files in parallel. The rewritten output does not change.
Measured on a real test suite (Apple M4 Pro, 14 cores), with the stock 2.0.0 task and this branch:
For comparison,
Csctook 5.3–6.9 s on the first project, so before this change rewriting cost more than compiling.Output check: all 389 generated
.sharp.g.csfiles of the large project are byte-for-byte the same as with 2.0.0.test-local.sh, including package tests, passes.Merge Danger
Reversibility: reversible
Blast Radius: build time only. Each file is still rewritten on its own, so running files in parallel cannot change the output. A file that fails to rewrite still falls back to the original source with a warning.