mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-05 19:00:33 -05:00
doc
This commit is contained in:
parent
f081c0f8ad
commit
0f4e115bc0
1 changed files with 11 additions and 0 deletions
|
|
@ -50,6 +50,17 @@ val for_ : ?chunk_size:int -> int -> (int -> int -> unit) -> unit
|
|||
let() = assert (Atomic.get total_sum = 4950)
|
||||
]}
|
||||
|
||||
Note how we still compute a local sum sequentially in [(fun low high -> …)],
|
||||
before combining it wholesale into [total_sum]. When the chunk size is large,
|
||||
this can have a dramatic impact on the synchronization overhead.
|
||||
|
||||
When [chunk_size] is not provided, the library will attempt to guess a value
|
||||
that keeps all cores busy but runs as few tasks as possible to reduce
|
||||
the synchronization overhead.
|
||||
|
||||
Use [~chunk_size:1] if you explicitly want to
|
||||
run each iteration of the loop in its own task.
|
||||
|
||||
@since NEXT_RELEASE
|
||||
{b NOTE} this is only available on OCaml 5. *)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue