@@ -10,6 +10,9 @@ struct Runner: ParsableCommand {
10
10
11
11
@Flag ( help: " Debug benchmark regexes " )
12
12
var debug = false
13
+
14
+ @Option ( help: " Load results from this file instead of rerunning " )
15
+ var load : String ?
13
16
14
17
@Option ( help: " The file results should be saved to " )
15
18
var save : String ?
@@ -34,7 +37,7 @@ struct Runner: ParsableCommand {
34
37
35
38
mutating func run( ) throws {
36
39
var runner = BenchmarkRunner . makeRunner ( samples, quiet)
37
-
40
+
38
41
if !self . specificBenchmarks. isEmpty {
39
42
runner. suite = runner. suite. filter { b in
40
43
specificBenchmarks. contains { pattern in
@@ -44,24 +47,29 @@ struct Runner: ParsableCommand {
44
47
}
45
48
if debug {
46
49
runner. debug ( )
50
+ return
51
+ }
52
+
53
+ if let loadFile = load {
54
+ try runner. load ( from: loadFile)
47
55
} else {
48
56
if excludeNs {
49
57
runner. suite = runner. suite. filter { b in !b. name. contains ( " NS " ) }
50
58
}
51
59
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 )
65
73
}
66
74
}
67
75
}
0 commit comments