mirror of
https://github.com/onyx-and-iris/aoc2024.git
synced 2025-01-08 13:50:48 +00:00
return early if total exceeds target
re-run benchmarks
This commit is contained in:
parent
d42df0cd84
commit
9bfd45aee4
@ -2,14 +2,14 @@ goos: linux
|
||||
goarch: amd64
|
||||
pkg: github.com/onyx-and-iris/aoc2024/day-07
|
||||
cpu: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
|
||||
BenchmarkSolve-12 1000000000 0.2486 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.2670 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.2498 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.2449 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.2520 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.2512 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.2500 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.2494 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.2473 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.2453 ns/op
|
||||
ok github.com/onyx-and-iris/aoc2024/day-07 37.477s
|
||||
BenchmarkSolve-12 1000000000 0.1503 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1498 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1577 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1621 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1490 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1437 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1566 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1508 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1465 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1468 ns/op
|
||||
ok github.com/onyx-and-iris/aoc2024/day-07 18.051s
|
||||
|
@ -2,5 +2,5 @@ goos: linux
|
||||
goarch: amd64
|
||||
pkg: github.com/onyx-and-iris/aoc2024/day-07/internal/one
|
||||
cpu: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
|
||||
BenchmarkSolve-12 1000000000 0.001456 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.001262 ns/op
|
||||
ok github.com/onyx-and-iris/aoc2024/day-07/internal/one 0.017s
|
||||
|
@ -37,6 +37,10 @@ func Solve(buf []byte) (int, error) {
|
||||
}
|
||||
|
||||
func next(target int, operands []int, total int, operator string) (int, bool) {
|
||||
if total > target {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
if len(operands) == 0 {
|
||||
if total == target {
|
||||
log.Debug(total)
|
||||
|
@ -2,5 +2,5 @@ goos: linux
|
||||
goarch: amd64
|
||||
pkg: github.com/onyx-and-iris/aoc2024/day-07/internal/two
|
||||
cpu: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
|
||||
BenchmarkSolve-12 1000000000 0.2539 ns/op
|
||||
ok github.com/onyx-and-iris/aoc2024/day-07/internal/two 3.822s
|
||||
BenchmarkSolve-12 1000000000 0.1525 ns/op
|
||||
ok github.com/onyx-and-iris/aoc2024/day-07/internal/two 1.642s
|
||||
|
@ -38,6 +38,10 @@ func Solve(buf []byte) (int, error) {
|
||||
}
|
||||
|
||||
func next(target int, operands []int, total int, operator string) (int, bool) {
|
||||
if total > target {
|
||||
return 0, false
|
||||
}
|
||||
|
||||
if len(operands) == 0 {
|
||||
if total == target {
|
||||
log.Debug(total)
|
||||
|
Loading…
Reference in New Issue
Block a user