Add Eio.Fiber.List.partition_map - #927
Conversation
| | x :: xs -> | ||
| let x = Limiter.fork_promise_exn limiter fn x in | ||
| let left, right = | ||
| match Promise.await x with |
There was a problem hiding this comment.
This seems to a fork a promise and then immediately wait on it. Are you sure it's actually running concurrently? It might just be simpler to have a one-liner let partition_map ?max_fibers fn items = List.partition_map Fun.id (map ?max_fibers fn items) (which allocates a bit more, but the dominant cost here would be fiber creation I expect).
talex5
left a comment
There was a problem hiding this comment.
Are you sure it's actually running concurrently?
Looks wrong to me too. And the test output also shows that it's not running concurrently.
It might just be simpler to have a one-liner
I agree: it makes sense to start with the one-liner, and optimise it later if it's a problem. @avsm's suggested one-liner also fixes the test output.
|
(I'm assuming this PR was closed because you decided it's easier to put the one-liner in your own code. Updating this PR to use it would also be fine.) |
|
Will do so once I get the chance. Thanks! |
bddf26a to
d6431b2
Compare
d6431b2 to
34cfbd5
Compare
I could not implement this myself since
Limiteris hidden from the interface.