mirror of
https://github.com/onyx-and-iris/aoc2024.git
synced 2025-01-09 14:20:48 +00:00
run part one with goroutines
re-run benchmarks
This commit is contained in:
parent
a4e8e83844
commit
52541e7ca7
@ -2,14 +2,14 @@ goos: linux
|
||||
goarch: amd64
|
||||
pkg: github.com/onyx-and-iris/aoc2024/day-19
|
||||
cpu: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
|
||||
BenchmarkSolve-12 1000000000 0.1996 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.2115 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1903 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1840 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1891 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1828 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1888 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1834 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1895 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1832 ns/op
|
||||
ok github.com/onyx-and-iris/aoc2024/day-19 24.811s
|
||||
BenchmarkSolve-12 1000000000 0.09381 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1010 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1131 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.09298 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.09649 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.09659 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1022 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.09501 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.09695 ns/op
|
||||
BenchmarkSolve-12 1000000000 0.1007 ns/op
|
||||
ok github.com/onyx-and-iris/aoc2024/day-19 9.903s
|
||||
|
@ -2,5 +2,5 @@ goos: linux
|
||||
goarch: amd64
|
||||
pkg: github.com/onyx-and-iris/aoc2024/day-19/internal/one
|
||||
cpu: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
|
||||
BenchmarkSolve-12 1000000000 0.1706 ns/op
|
||||
ok github.com/onyx-and-iris/aoc2024/day-19/internal/one 2.018s
|
||||
BenchmarkSolve-12 1000000000 0.08205 ns/op
|
||||
ok github.com/onyx-and-iris/aoc2024/day-19/internal/one 0.765s
|
||||
|
@ -18,11 +18,19 @@ func Solve(buf []byte) (int, error) {
|
||||
|
||||
log.Debug(stripes, designs)
|
||||
|
||||
var sum int
|
||||
conc := len(designs)
|
||||
sumChan := make(chan bool)
|
||||
for _, design := range designs {
|
||||
ok := isPossibleArrangement(design, stripes)
|
||||
go func() {
|
||||
ok := isPossibleArrangement(design, stripes)
|
||||
sumChan <- ok
|
||||
}()
|
||||
}
|
||||
|
||||
var sum int
|
||||
for range conc {
|
||||
ok := <-sumChan
|
||||
if ok {
|
||||
log.Debugf("design: %s is possible", design)
|
||||
sum++
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user