Skip to content

Commit 70b5a43

Browse files
committed
WIP: hack around to make performance test parse incrementally
1 parent da4ff2d commit 70b5a43

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Sources/swift-parser-cli/swift-parser-cli.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,15 @@ class PerformanceTest: ParsableCommand {
180180

181181
let start = Date()
182182
let startInstructions = getInstructionsExecuted()
183-
for _ in 0..<self.iterations {
183+
let parseTransition = IncrementalParseTransition()
184+
var previousTreeDict: [Data:SourceFileSyntax] = [:]
185+
for iter in 0..<self.iterations {
184186
for file in files {
187+
if iter != 0 {
188+
parseTransition.setupTransition(tree: previousTreeDict[file]!, edits: ConcurrentEdits(fromSequential: []))
189+
}
185190
file.withUnsafeBytes { buf in
186-
_ = Parser.parse(source: buf.bindMemory(to: UInt8.self))
191+
previousTreeDict[file] = Parser.parse(source: buf.bindMemory(to: UInt8.self), parseTransition: parseTransition)
187192
}
188193
}
189194
}

0 commit comments

Comments
 (0)