-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solutions | Added Solution & Benchmark Class Kotlin Doc
- Loading branch information
Showing
15 changed files
with
140 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...ry/src/main/kotlin/io/github/tomplum/libs/solutions/benchmark/data/BenchmarkComparison.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,29 @@ | ||
package io.github.tomplum.libs.solutions.benchmark.data | ||
|
||
/** | ||
* A comparison between two [BenchmarkResult]. | ||
* Calculates runtime deltas between the [previousRun] and the [lastRun]. | ||
* @param previousRun The previous solution run from the serialised XML file. | ||
* @param lastRun The most recent solution to run. | ||
*/ | ||
class BenchmarkComparison(private val previousRun: BenchmarkResult, val lastRun: BenchmarkResult) { | ||
/** | ||
* Calculates the runtime delta between each of the respective day parts for given runs. | ||
* @return A list of benchmark result runtime deltas. | ||
*/ | ||
fun getDeltas(): List<BenchmarkDelta> = previousRun.results.zip(lastRun.results).map { (previous, last) -> | ||
BenchmarkDelta(previous.day, last.runtime1 - previous.runtime1, last.runtime2 - previous.runtime2) | ||
} | ||
|
||
/** | ||
* Calculates the runtime delta between the average runtime of both results. | ||
* @return The delta of the runtime averages. | ||
*/ | ||
fun getAvgDelta(): Long = lastRun.getAvgTime() - previousRun.getAvgTime() | ||
|
||
/** | ||
* Calculates the runtime delta between the total runtime of both results. | ||
* @return The delta of the runtime totals. | ||
*/ | ||
fun getTotalDelta(): Long = lastRun.getTotalTime() - previousRun.getTotalTime() | ||
} |
7 changes: 7 additions & 0 deletions
7
library/src/main/kotlin/io/github/tomplum/libs/solutions/benchmark/data/BenchmarkDelta.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
package io.github.tomplum.libs.solutions.benchmark.data | ||
|
||
/** | ||
* The runtime deltas of a single days solution between two benchmarking runs. | ||
* | ||
* @param day The day number. | ||
* @param p1 The runtime delta of part one in nanoseconds. | ||
* @param p2 The runtime delta of part two in nanoseconds. | ||
*/ | ||
data class BenchmarkDelta(val day: Int, val p1: Long, val p2: Long) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...c/main/kotlin/io/github/tomplum/libs/solutions/benchmark/report/BenchmarkDefaultReport.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
library/src/main/kotlin/io/github/tomplum/libs/solutions/benchmark/report/DeltaReport.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
library/src/main/kotlin/io/github/tomplum/libs/solutions/benchmark/report/ReportingMode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
package io.github.tomplum.libs.solutions.benchmark.report | ||
|
||
import io.github.tomplum.libs.solutions.benchmark.utility.BenchmarkUtility | ||
|
||
/** | ||
* Denotes the type of benchmark report to be produced. | ||
* @see BenchmarkUtility | ||
*/ | ||
enum class ReportingMode { | ||
COMPACT, VERBOSE, DEFAULT | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters