Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1908672

Browse files
add printTimeNotice()
1 parent 742c2dc commit 1908672

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

‎src/main/java/com/codefork/aoc2024/Problem.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
public abstract class Problem {
1111

12+
public static String CPU = "Ryzen 5850U";
13+
1214
/**
1315
* Solve this problem
1416
*/
@@ -66,6 +68,10 @@ public Stream<String> getSampleInput() {
6668
return getFileAsStream("sample");
6769
}
6870

71+
public void printTimeNotice(String time) {
72+
System.out.printf("TODO: This takes ~%s to run (on a %s), needs to be optimized%n", time, CPU);
73+
}
74+
6975
/**
7076
* run the solution
7177
*/

‎src/main/java/com/codefork/aoc2024/day14/Part02.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public String solve(int width, int height, Stream<String> data) {
1515
// a few false positives before yielding the answer, so it was just a matter of increasing
1616
// the threshold to something reasonable once I knew what the Christmas tree actually looked like.
1717

18-
System.out.println("This takes ~40 seconds");
18+
printTimeNotice("40s");
1919
var swarm = Swarm.create(data, width, height);
2020
var keepGoing = true;
2121
var i = 0;

‎src/main/java/com/codefork/aoc2024/day20/Part02.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public String solve(Stream<String> data, boolean printSummary) {
3737
@Override
3838
public String solve() {
3939
//return solve(getSampleInput(), true);
40-
System.out.println("TODO: This takes ~25s to run, needs to be optimized");
40+
printTimeNotice("25s");
4141
return solve(getInput(), false);
4242
}
4343

‎src/main/java/com/codefork/aoc2024/day21/Part02.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
public class Part02 extends Problem {
88

99
public String solve(Stream<String> data) {
10-
System.out.println("TODO: This takes ~1 minute to run, needs to be optimized");
10+
printTimeNotice("1 min");
1111
return String.valueOf(ShipLock.calculateSumOfComplexities(data, 25));
1212
}
1313

‎src/main/java/com/codefork/aoc2024/day24/Part02.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
public class Part02 extends Problem {
88

99
public String solve(Stream<String> data) {
10-
System.out.println("This takes ~30s to run");
10+
printTimeNotice("30s");
1111
var device = Device.parse(data);
1212
return Device.formatAnswer(device.findSwapsToMakeAdder());
1313
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /