Skip to content

Commit 1b761be

Browse files
committed
Disable compile time comparisons by default
1 parent 662870e commit 1b761be

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

Sources/RegexBenchmark/BenchmarkResults.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,18 @@ extension BenchmarkRunner {
3434
if let saveFile = saveTo {
3535
try saveComparisons(comparisons, path: saveFile)
3636
}
37-
37+
}
38+
39+
func compareCompileTimes(against compareFilePath: String, showChart: Bool) throws {
40+
let compareFileURL = URL(fileURLWithPath: compareFilePath)
41+
let compareResult = try SuiteResult.load(from: compareFileURL)
42+
let compareFile = compareFileURL.lastPathComponent
43+
3844
let compileTimeComparisons = results
3945
.compareCompileTimes(with: compareResult)
4046
.filter({!$0.name.contains("_NS")})
4147
.filter({$0.diff != nil})
42-
print("Comparing estimated compile times")
48+
print("[Experimental] Comparing estimated compile times")
4349
displayComparisons(compileTimeComparisons, false, against: "saved benchmark result " + compareFile)
4450
}
4551

@@ -96,7 +102,7 @@ extension BenchmarkRunner {
96102
try! FileManager.default.createDirectory(atPath: parent.path, withIntermediateDirectories: true)
97103
}
98104

99-
var contents = "name,baseline,latest,diff,percentage\n"
105+
var contents = "name,latest,baseline,diff,percentage\n"
100106
for comparison in comparisons {
101107
contents += comparison.asCsv + "\n"
102108
}

Sources/RegexBenchmark/CLI.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ struct Runner: ParsableCommand {
2020
@Option(help: "The result file to compare against")
2121
var compare: String?
2222

23+
@Option(help: "Experimental compile time comparison")
24+
var experimentalCompareCompileTimes: String?
25+
2326
@Flag(help: "Show comparison chart")
2427
var showChart: Bool = false
2528

@@ -71,5 +74,8 @@ struct Runner: ParsableCommand {
7174
if let compareFile = compare {
7275
try runner.compare(against: compareFile, showChart: showChart, saveTo: saveComparison)
7376
}
77+
if let compareFile = experimentalCompareCompileTimes {
78+
try runner.compareCompileTimes(against: compareFile, showChart: showChart)
79+
}
7480
}
7581
}

0 commit comments

Comments
 (0)