File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Sources/swift-parser-cli/Commands Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import _InstructionCounter
1414import ArgumentParser
1515import Foundation
1616import SwiftParser
17+ import SwiftSyntax
1718
1819struct PerformanceTest : ParsableCommand {
1920 static var configuration = CommandConfiguration (
@@ -39,10 +40,15 @@ struct PerformanceTest: ParsableCommand {
3940
4041 let start = Date ( )
4142 let startInstructions = getInstructionsExecuted ( )
42- for _ in 0 ..< self . iterations {
43+ let parseTransition = IncrementalParseTransition ( )
44+ var previousTreeDict : [ Data : SourceFileSyntax ] = [ : ]
45+ for iter in 0 ..< self . iterations {
4346 for file in files {
47+ if iter != 0 {
48+ parseTransition. setupTransition ( tree: previousTreeDict [ file] !, edits: ConcurrentEdits ( fromSequential: [ ] ) )
49+ }
4450 file. withUnsafeBytes { buf in
45- _ = Parser . parse ( source: buf. bindMemory ( to: UInt8 . self) )
51+ previousTreeDict [ file ] = Parser . parse ( source: buf. bindMemory ( to: UInt8 . self) , parseTransition : parseTransition )
4652 }
4753 }
4854 }
You can’t perform that action at this time.
0 commit comments