@@ -10,6 +10,9 @@ struct Runner: ParsableCommand {
1010
1111 @Flag ( help: " Debug benchmark regexes " )
1212 var debug = false
13+
14+ @Option ( help: " Load results from this file instead of rerunning " )
15+ var load : String ?
1316
1417 @Option ( help: " The file results should be saved to " )
1518 var save : String ?
@@ -34,7 +37,7 @@ struct Runner: ParsableCommand {
3437
3538 mutating func run( ) throws {
3639 var runner = BenchmarkRunner . makeRunner ( samples, quiet)
37-
40+
3841 if !self . specificBenchmarks. isEmpty {
3942 runner. suite = runner. suite. filter { b in
4043 specificBenchmarks. contains { pattern in
@@ -44,24 +47,29 @@ struct Runner: ParsableCommand {
4447 }
4548 if debug {
4649 runner. debug ( )
50+ return
51+ }
52+
53+ if let loadFile = load {
54+ try runner. load ( from: loadFile)
4755 } else {
4856 if excludeNs {
4957 runner. suite = runner. suite. filter { b in !b. name. contains ( " NS " ) }
5058 }
5159 runner. run ( )
52- if let saveFile = save {
53- try runner . save ( to : saveFile )
54- }
55- if saveComparison != nil && compareWithNS && compare != nil {
56- print ( " Unable to save both comparison results, specify only one compare operation " )
57- return
58- }
59- if compareWithNS {
60- try runner . compareWithNS ( showChart : showChart , saveTo : saveComparison )
61- }
62- if let compareFile = compare {
63- try runner . compare ( against : compareFile , showChart : showChart , saveTo : saveComparison )
64- }
60+ }
61+ if let saveFile = save {
62+ try runner . save ( to : saveFile )
63+ }
64+ if saveComparison != nil && compareWithNS && compare != nil {
65+ print ( " Unable to save both comparison results, specify only one compare operation " )
66+ return
67+ }
68+ if compareWithNS {
69+ try runner . compareWithNS ( showChart : showChart , saveTo : saveComparison )
70+ }
71+ if let compareFile = compare {
72+ try runner . compare ( against : compareFile , showChart : showChart , saveTo : saveComparison )
6573 }
6674 }
6775}
0 commit comments