You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Further reduce lock contention around macroConfigPaths
We were still going through the lock once for every `MacroValueAssignment` which was causing performance issues during config file parsing. This didn't really make sense since we can instead do the insert in `MacroConfigFileParser` and otherwise only deal in index references. Real locations only need to be materialized for code that deals with them.
rdar://164650188
Copy file name to clipboardExpand all lines: Sources/SWBMacro/MacroConfigFileParser.swift
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,7 @@
12
12
13
13
publicimport SWBUtil
14
14
import Foundation
15
+
import Synchronization
15
16
16
17
privateextensionUInt8{
17
18
varisASCIISpace:Bool{
@@ -35,6 +36,7 @@ public final class MacroConfigFileParser {
35
36
36
37
/// The path to the xcconfig file being parsed, for diagnostic purposes.
37
38
publicletpath:Path
39
+
privateletpathRef:OrderedSet<Path>.Index
38
40
39
41
/// Current index into the UTF-8 byte sequence that’s being parsed. Starts at zero. All meaningful characters are in the ASCII range, which is what lets us do this optimization.
40
42
varcurrIdx:Int
@@ -57,6 +59,7 @@ public final class MacroConfigFileParser {
@@ -585,7 +588,7 @@ public protocol MacroConfigFileParserDelegate {
585
588
func endPreprocessorInclusion()
586
589
587
590
/// Invoked once for each macro value assignment. The `macroName` is guaranteed to be non-empty, but `value` may be empty. Any macro conditions are passed as tuples in the `conditions`; parameters are guaranteed to be non-empty strings, but patterns may be empty.
/// A mapping from macro declarations to corresponding macro value assignments, each of which is a linked list of macro expressions in precedence order. At the moment it doesn’t support conditional assignments, but that functionality will be implemented soon.
@@ -78,14 +78,7 @@ public struct MacroValueAssignmentTable: Serializable, Sendable {
78
78
79
79
80
80
/// Adds a mapping from `macro` to `value`, inserting it ahead of any already existing assignment for the same macro. Unless the value refers to the lower-precedence expression (using `$(inherited)` notation), any existing assignments are shadowed but not removed.
0 commit comments