diff --git a/src/crew.gleam b/src/crew.gleam index f7a42b2..45cfa10 100644 --- a/src/crew.gleam +++ b/src/crew.gleam @@ -319,6 +319,9 @@ pub fn parallel_map( timeout timeout: Int, with fun: fn(a) -> b, ) -> List(b) { + // we don't want to do the multiple subject trick here since that is + // potentially O(n^2) + let unordered: List(#(Int, b)) = list |> list.index_map(fn(item, index) { fn() { #(index, fun(item)) } }) @@ -429,6 +432,9 @@ pub fn subscribe(pool: Name(PoolMsg)) -> Channel(a) { /// Work results arrive in completion order. It is your responsibility to handle /// the lifecycle and ordering. /// +/// This adds a specific monitor to the selector to handle the case where the pool +/// goes down, so it's better to prefer few channels over many. +/// /// ## Panics /// - If a worker or the pool crashes while executing work, the selector will /// panic with details about the crash.