Skip to content

Commit

Permalink
add benchmark flag and update action
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmckendry committed Nov 17, 2023
1 parent 6f1cf6e commit ae93cf2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/readmeStats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: cd 2022 && go build .
- run: cd 2022 && ./aoc2022
- run: cd 2022 && ./aoc2022 -benchmark
- run: cd 2023 && go build .
- run: cd 2023 && ./aoc2023
- run: cd 2023 && ./aoc2023 -benchmark
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update readme statistics
13 changes: 11 additions & 2 deletions 2022/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"flag"
"fmt"
"os"
"strconv"

"aoc2022/utils"
Expand All @@ -27,10 +29,17 @@ var solutions = map[string]func(){
}

func main() {
for _, solution := range solutions {
utils.Benchmark(solution)
benchmark := flag.Bool("benchmark", false, "Run benchmarks")
flag.Parse()

if !*benchmark {
for _, solution := range solutions {
utils.Benchmark(solution)
}
os.Exit(0)
}

// Run the full benchark suite and update the README
updateReadme()
}

Expand Down
13 changes: 11 additions & 2 deletions 2023/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"flag"
"fmt"
"os"
"strconv"

"aoc2023/utils"
Expand All @@ -13,10 +15,17 @@ var solutions = map[string]func(){
}

func main() {
for _, solution := range solutions {
utils.Benchmark(solution)
benchmark := flag.Bool("benchmark", false, "Run benchmarks")
flag.Parse()

if !*benchmark {
for _, solution := range solutions {
utils.Benchmark(solution)
}
os.Exit(0)
}

// Run the full benchark suite and update the README
updateReadme()
}

Expand Down

0 comments on commit ae93cf2

Please sign in to comment.