EachMap? Or safe slice and map types? #3
Unanswered
earthboundkid
asked this question in
Ideas
Replies: 1 comment 4 replies
-
Writing spotlightpa/sheets-uploader#1 was useful because it had a good case for using a concurrent safe slice. I needed it to upload the list of invalidations to CloudFront afterwards. It might also be nice to add a buffer pool to Flowmatic, since that's a common need. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
On the one hand,
results, err := flowmatic.Map(workers, items, task)
is a very obvious API. OTOH, it's probably slower than serial code in most instances? It seems like it needs batching to be any good. Does anyone really need it?So maybe the answer is to approach from the other angle and have flowmatic container types than are goroutine safe and tell people to use those with
Each
? Sayflowmatic.MakeSlice[T](cap)
andflowmatic.MakeMap[K, V](cap)
that return types with a Push/Add method and a Slice/Map method that panics if you Push/Add after ejecting.Do we need an
Each
variant function that bails on failure? Is there some way to reduce the API surface by generalizing without just recreating errorgroup?Beta Was this translation helpful? Give feedback.
All reactions