Skip to content

Commit

Permalink
Set saner benchmark loop ammount
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmckendry committed Dec 16, 2023
1 parent d319752 commit 13172c1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion 2022/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func GetSolutionStatistics(solutions map[string]func()) []SolutionStatistics {
problemName := strings.Split(name, ":")[1]

averageExecutionTime := time.Duration(0)
for i := 0; i < 100; i++ {
for i := 0; i < 10; i++ {
averageExecutionTime += Benchmark(solutions[name])
}

Expand Down
2 changes: 1 addition & 1 deletion 2023/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func GetSolutionStatistics(solutions map[string]func()) []SolutionStatistics {
problemName := strings.Split(name, ":")[1]

averageExecutionTime := time.Duration(0)
for i := 0; i < 100; i++ {
for i := 0; i < 10; i++ {
averageExecutionTime += Benchmark(solutions[name])
}

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ All my solutions to the [Advent of Code](https://adventofcode.com/) challenges,

## Project Structure
I've separated each year into its own Go module. Each day is separated into two files, one for each part of the challenge. To run a solution, simply `cd` into the directory and run `go run . -solution 01p1` (where `01p1` is the day and part you want to run).
The `-benchmark` flag can be used to time the execution of the solution. Using the `-benchmark` flag on its own will run all solutions for the year 100 times over, getting the average execution time.
The `-benchmark` flag can be used to time the execution of the solution. Using the `-benchmark` flag on its own will run all solutions for the year 10 times over, getting the average execution time.

> [!NOTE]
> Benchmarks are run via [this GitHub Action](https://github.com/scottmckendry/aoc/actions/workflows/readmeStats.yml) and are not indicative of the performance of the code on your machine.
> The action uses the `ubuntu-latest` image and runs each solution 100 times to get an average. This is by no means a perfect benchmark, so take the results below with a grain of salt.
> The action uses the `ubuntu-latest` image and runs each solution 10 times to get an average. This is by no means a perfect benchmark, so take the results below with a grain of salt.
## 2023
<!-- 2023TableStart -->
Expand Down

0 comments on commit 13172c1

Please sign in to comment.