Commit 1fd4250
committed
Explicitly copy defsIDependUpon into an appropriately sized array when initializing SourceFileDependencyGraph.Node
Previously, the removeAll call below the initializer would trigger CoW. If the scratch buffer was larger than the count, this would result in an unnecesarily large allocation. In a very large file, the source-file-provides-implementation node may have multiple orders of magnitude more edges compared to any other node in the graph, which could lead to excessive memory usage and a large slowdown deallocating the array storage when tearing down the graph.
rdar://956482821 parent ff9682e commit 1fd4250
File tree
1 file changed
+5
-1
lines changed- Sources/SwiftDriver/IncrementalCompilation
1 file changed
+5
-1
lines changedLines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
230 | 234 | | |
231 | 235 | | |
232 | 236 | | |
233 | | - | |
| 237 | + | |
234 | 238 | | |
235 | 239 | | |
236 | 240 | | |
| |||
0 commit comments