mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
perf pool: no retries for self-queue; fewer retries for stealing
This commit is contained in:
parent
e937bf0e9d
commit
056986c84f
1 changed files with 3 additions and 12 deletions
15
src/pool.ml
15
src/pool.ml
|
|
@ -97,11 +97,8 @@ exception Got_task of task
|
||||||
|
|
||||||
type around_task = AT_pair : (t -> 'a) * (t -> 'a -> unit) -> around_task
|
type around_task = AT_pair : (t -> 'a) * (t -> 'a -> unit) -> around_task
|
||||||
|
|
||||||
(** How many times in a row do we try to read the next local task? *)
|
|
||||||
let run_self_task_max_retry = 5
|
|
||||||
|
|
||||||
(** How many times in a row do we try to do work-stealing? *)
|
(** How many times in a row do we try to do work-stealing? *)
|
||||||
let steal_attempt_max_retry = 7
|
let steal_attempt_max_retry = 3
|
||||||
|
|
||||||
let worker_thread_ (self : state) (runner : t) (w : worker_state) ~on_exn
|
let worker_thread_ (self : state) (runner : t) (w : worker_state) ~on_exn
|
||||||
~around_task : unit =
|
~around_task : unit =
|
||||||
|
|
@ -120,16 +117,10 @@ let worker_thread_ (self : state) (runner : t) (w : worker_state) ~on_exn
|
||||||
|
|
||||||
let run_self_tasks_ () =
|
let run_self_tasks_ () =
|
||||||
let continue = ref true in
|
let continue = ref true in
|
||||||
let pop_retries = ref 0 in
|
|
||||||
while !continue do
|
while !continue do
|
||||||
match WSQ.pop w.q with
|
match WSQ.pop w.q with
|
||||||
| Some task ->
|
| Some task -> run_task task
|
||||||
pop_retries := 0;
|
| None -> continue := false
|
||||||
run_task task
|
|
||||||
| None ->
|
|
||||||
Domain_.relax ();
|
|
||||||
incr pop_retries;
|
|
||||||
if !pop_retries > run_self_task_max_retry then continue := false
|
|
||||||
done
|
done
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue