Skip to content

Commit

Permalink
Consider notes and commas in benchmark checking
Browse files Browse the repository at this point in the history
Remove commas from formatted numbers before trying to convert them.
Start counting data at the third column to factor for notes.
  • Loading branch information
ahmedre committed Jun 10, 2022
1 parent 2a3da92 commit f7b6c7a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import kotlin.math.min
object BenchmarkChecker {

fun checkResults(before: List<List<Any>>, after: List<List<Any>>, threshold: Int): List<BenchmarkStep> {
// each row has <date> <git hash> [scenario_1_time, scenario_2_time ... scenario_n_time
val runs = min(before.minOf { it.size }, after.minOf { it.size }) - 2
// each row has <date> <git hash> <notes> [scenario_1_time, scenario_2_time ... scenario_n_time
val runs = min(before.minOf { it.size }, after.minOf { it.size }) - 3
return (1..runs).map { scenarioNumber ->
// index 0 is the date, index 1 is the hash, so scenario 1 is index 2
val scenarioIndex = scenarioNumber + 1
val runsBefore = before.map { it[scenarioIndex].toString().toDouble() }
val runsAfter = after.map { it[scenarioIndex].toString().toDouble() }
// index 0 is the date, index 1 is the hash, index 2 is notes, so scenario 1 is index 3
val scenarioIndex = scenarioNumber + 2
val runsBefore = before.map { it[scenarioIndex].toString().replace(",", "").toDouble() }
val runsAfter = after.map { it[scenarioIndex].toString().replace(",", "").toDouble() }

val stepDelta = StepFit.stepFit(runsBefore, runsAfter)
if (stepDelta.absoluteValue >= threshold) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ object CheckDeltaUtil {

val results = BenchmarkChecker.checkResults(before, after, threshold)
results.forEachIndexed { index, scenarioResult ->
// date, git hash
val scenariosOffset = 2
// date, git hash, notes
val scenariosOffset = 3
val gitHash = mergeToConsider[1]
val scenario = scenariosRow[index + scenariosOffset]

Expand Down

0 comments on commit f7b6c7a

Please sign in to comment.