ForEach executes f in parallel over each element in input. It is safe to mutate the input parameter, which makes it possible to map in place. ForEach always uses at most runtime.GOMAXPROCS goroutines. It takes roughly 2µs to start up the goroutines and adds an overhead of roughly 50ns per element
(input []T, f func(*T))
| 34 | // an overhead of roughly 50ns per element of input. For |
| 35 | // a configurable goroutine limit, use a custom Iterator. |
| 36 | func ForEach[T any](input []T, f func(*T)) { Iterator[T]{}.ForEach(input, f) } |
| 37 | |
| 38 | // ForEach executes f in parallel over each element in input, |
| 39 | // using up to the Iterator's configured maximum number of |
searching dependent graphs…