mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
prepare for 0.5
This commit is contained in:
parent
f50ffe9891
commit
fd2102c7fe
8 changed files with 49 additions and 13 deletions
36
CHANGES.md
36
CHANGES.md
|
|
@ -1,4 +1,40 @@
|
||||||
|
|
||||||
|
# 0.5
|
||||||
|
|
||||||
|
## features
|
||||||
|
|
||||||
|
- add `Bb_queue.transfer`
|
||||||
|
-add `Bb_queue.to_{iter,gen,seq}`
|
||||||
|
- add `Fifo_pool`, a simple pool with a single blocking queue for
|
||||||
|
workloads with coarse granularity tasks that value
|
||||||
|
latency (e.g. a web server)
|
||||||
|
- add a work-stealing pool for heavy compute workloads that
|
||||||
|
feature a lot of await/fork-join, with a lot of help
|
||||||
|
from Vesa Karvonen (@polytypic)
|
||||||
|
- add `Fut.spawn_on_current_runner`
|
||||||
|
- add `Runner.{spawn_on_current_runner, await}`
|
||||||
|
- add a few more toplevel aliases in `Moonpool` itself
|
||||||
|
- add `No_runner`: a runner that runs tasks synchronously in the caller
|
||||||
|
- on shutdown, pools will finish running all present tasks before
|
||||||
|
closing. New tasks are immediately rejected.
|
||||||
|
|
||||||
|
- use an optional dependency on `thread-local-storage` to
|
||||||
|
implement work stealing and `spawn_on_current_runner`
|
||||||
|
|
||||||
|
## optimizations
|
||||||
|
|
||||||
|
- use the main domain to spawn threads on it. This means we can really
|
||||||
|
use all cores, not all but one.
|
||||||
|
- in `Fork_join.both`, only one of the two sides schedules a task,
|
||||||
|
the other runs in the current thread. This reduces scheduling overhead.
|
||||||
|
- compare to domainslib in benchmarks. With the WS pool we're now slightly
|
||||||
|
ahead in terms of overhead on the recursive fib benchmark.
|
||||||
|
|
||||||
|
## breaking
|
||||||
|
|
||||||
|
- deprecate `Pool`, now an alias to `Fifo_pool`
|
||||||
|
|
||||||
|
|
||||||
# 0.4
|
# 0.4
|
||||||
|
|
||||||
- add `Fut.{reify_error,bind_reify_error}`
|
- add `Fut.{reify_error,bind_reify_error}`
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
(using mdx 0.2)
|
(using mdx 0.2)
|
||||||
|
|
||||||
(name moonpool)
|
(name moonpool)
|
||||||
(version 0.4)
|
(version 0.5)
|
||||||
(generate_opam_files true)
|
(generate_opam_files true)
|
||||||
(source
|
(source
|
||||||
(github c-cube/moonpool))
|
(github c-cube/moonpool))
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# This file is generated by dune, edit dune-project instead
|
# This file is generated by dune, edit dune-project instead
|
||||||
opam-version: "2.0"
|
opam-version: "2.0"
|
||||||
version: "0.4"
|
version: "0.5"
|
||||||
synopsis: "Pools of threads supported by a pool of domains"
|
synopsis: "Pools of threads supported by a pool of domains"
|
||||||
maintainer: ["Simon Cruanes"]
|
maintainer: ["Simon Cruanes"]
|
||||||
authors: ["Simon Cruanes"]
|
authors: ["Simon Cruanes"]
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
have higher throughput but they're very unfair to some tasks; by
|
have higher throughput but they're very unfair to some tasks; by
|
||||||
contrast, here, older tasks have priority over younger tasks.
|
contrast, here, older tasks have priority over younger tasks.
|
||||||
|
|
||||||
@since NEXT_RELEASE *)
|
@since 0.5 *)
|
||||||
|
|
||||||
include module type of Runner
|
include module type of Runner
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ val spawn_on_current_runner : (unit -> 'a) -> 'a t
|
||||||
|
|
||||||
See {!Runner.get_current_runner} to see how the runner is found.
|
See {!Runner.get_current_runner} to see how the runner is found.
|
||||||
|
|
||||||
@since NEXT_RELEASE
|
@since 0.5
|
||||||
@raise Failure if run from outside a runner. *)
|
@raise Failure if run from outside a runner. *)
|
||||||
|
|
||||||
val reify_error : 'a t -> 'a or_error t
|
val reify_error : 'a t -> 'a or_error t
|
||||||
|
|
@ -218,9 +218,9 @@ val wait_block_exn : 'a t -> 'a
|
||||||
They were previously present as [module Infix_local] and [val infix],
|
They were previously present as [module Infix_local] and [val infix],
|
||||||
but are now simplified.
|
but are now simplified.
|
||||||
|
|
||||||
@since NEXT_RELEASE *)
|
@since 0.5 *)
|
||||||
|
|
||||||
(** @since NEXT_RELEASE *)
|
(** @since 0.5 *)
|
||||||
module Infix : sig
|
module Infix : sig
|
||||||
val ( >|= ) : 'a t -> ('a -> 'b) -> 'b t
|
val ( >|= ) : 'a t -> ('a -> 'b) -> 'b t
|
||||||
val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
|
val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
Another situation is when threads cannot be used at all (e.g. because you
|
Another situation is when threads cannot be used at all (e.g. because you
|
||||||
plan to call [Unix.fork] later).
|
plan to call [Unix.fork] later).
|
||||||
|
|
||||||
@since NEXT_RELEASE
|
@since 0.5
|
||||||
*)
|
*)
|
||||||
|
|
||||||
include module type of Runner
|
include module type of Runner
|
||||||
|
|
|
||||||
|
|
@ -27,29 +27,29 @@ val run_async : Runner.t -> (unit -> unit) -> unit
|
||||||
(** [run_async runner task] schedules the task to run
|
(** [run_async runner task] schedules the task to run
|
||||||
on the given runner. This means [task()] will be executed
|
on the given runner. This means [task()] will be executed
|
||||||
at some point in the future, possibly in another thread.
|
at some point in the future, possibly in another thread.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.5 *)
|
||||||
|
|
||||||
val recommended_thread_count : unit -> int
|
val recommended_thread_count : unit -> int
|
||||||
(** Number of threads recommended to saturate the CPU.
|
(** Number of threads recommended to saturate the CPU.
|
||||||
For IO pools this makes little sense (you might want more threads than
|
For IO pools this makes little sense (you might want more threads than
|
||||||
this because many of them will be blocked most of the time).
|
this because many of them will be blocked most of the time).
|
||||||
@since NEXT_RELEASE *)
|
@since 0.5 *)
|
||||||
|
|
||||||
val spawn : on:Runner.t -> (unit -> 'a) -> 'a Fut.t
|
val spawn : on:Runner.t -> (unit -> 'a) -> 'a Fut.t
|
||||||
(** [spawn ~on f] runs [f()] on the runner (a thread pool typically)
|
(** [spawn ~on f] runs [f()] on the runner (a thread pool typically)
|
||||||
and returns a future result for it. See {!Fut.spawn}.
|
and returns a future result for it. See {!Fut.spawn}.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.5 *)
|
||||||
|
|
||||||
val spawn_on_current_runner : (unit -> 'a) -> 'a Fut.t
|
val spawn_on_current_runner : (unit -> 'a) -> 'a Fut.t
|
||||||
(** See {!Fut.spawn_on_current_runner}.
|
(** See {!Fut.spawn_on_current_runner}.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.5 *)
|
||||||
|
|
||||||
[@@@ifge 5.0]
|
[@@@ifge 5.0]
|
||||||
|
|
||||||
val await : 'a Fut.t -> 'a
|
val await : 'a Fut.t -> 'a
|
||||||
(** Await a future. See {!Fut.await}.
|
(** Await a future. See {!Fut.await}.
|
||||||
Only on OCaml >= 5.0.
|
Only on OCaml >= 5.0.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.5 *)
|
||||||
|
|
||||||
[@@@endif]
|
[@@@endif]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,4 +70,4 @@ end
|
||||||
val get_current_runner : unit -> t option
|
val get_current_runner : unit -> t option
|
||||||
(** Access the current runner. This returns [Some r] if the call
|
(** Access the current runner. This returns [Some r] if the call
|
||||||
happens on a thread that belongs in a runner.
|
happens on a thread that belongs in a runner.
|
||||||
@since NEXT_RELEASE *)
|
@since 0.5 *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue