Repository navigation
chore: Do not use PLINQ to create the ignore patterns - #1797
Conversation
✅ Deploy Preview for testcontainers-dotnet ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughFile enumeration and ignore-pattern processing no longer use parallel queries. ChangesImage processing
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to
|
What does this PR do?
This PR removes PLINQ from creating the Docker build context.
IgnoreFile.Acceptsnow checks the patterns in a loop from the last to the first and stops at the first match, so the last matching pattern still decides whether a file is accepted.IgnoreFilecreates the ignore patterns with LINQ instead ofAsParallel().AsOrdered(), andDockerfileArchivecollects the build context files withoutAsParallel().Why is it important?
Acceptsruns for every file in the build context, and each call started a PLINQ query over a few regular expressions. The query setup costs more than the matching itself. For a context with ~5,200 files, checking all files takes 35 ms instead of 96 ms and allocates ~33 MB less. PLINQ also blocks the calling thread until the thread pool runs its work, so when the thread pool is busy, e.g. in large test suites, creating the build context can stall for several seconds. WithoutAsOrdered(), the files were also added to the tar archive in a different order on every run. The order is stable now.Related issues
-
Summary by CodeRabbit