embroidery.api
bounded-pmap*
(bounded-pmap* n f coll)Version of pmap which uses JVM 21+ virtual threads when available, but will chunk the work up such that at most n concurrent virtual threads will be used (useful for workloads where system resource constraints could be exceeded e.g. maximum number of open file handles).
Notes:
- degrades to vanilla pmap on JVMs that don’t support virtual threads
- virtual thread version is partially lazy (results are computed eagerly, but merged lazily using concat)
- non virtual thread version ignores the
nargument (since pmap chunkscollitself, based on the number of CPUs) - each invocation of
bounded-pmap*utilises an independent set of virtual threads, so parallel invocations may exceed system resource constraints
future*
macro
(future* & body)future-call*
(future-call* f)Version of future-call that uses JVM 21+ virtual threads when available.
Notes:
- degrades to vanilla future-call on JVMs that don’t support virtual threads
pmap*
(pmap* f coll)