Simon Cruanes
c4d67f83ca
update doc and readme
2023-10-29 18:41:39 -04:00
Simon Cruanes
ff257df69d
add Moonpool.run_async
2023-10-29 18:41:39 -04:00
Simon Cruanes
ee882a0eae
refactor: use a fixed size work-stealing deque
...
if it's full, tasks overflow into the main queue.
2023-10-29 18:41:38 -04:00
Simon Cruanes
8f9c33ba2c
fix compilation error
2023-10-29 18:41:02 -04:00
Simon Cruanes
64f49b3907
fix: rename Thread_local_storage_ to not collide with the library
2023-10-29 18:30:01 -04:00
Simon Cruanes
8aaed6d951
fix tests to use new API
2023-10-28 13:19:44 -04:00
Simon Cruanes
d09da9c092
breaking: change interface for number of threads
...
now the user can specify `num_threads`; if not provided a sensible
default is picked.
2023-10-28 13:00:15 -04:00
Simon Cruanes
22624441fd
rename no_runner to immediate_runner
2023-10-28 13:00:03 -04:00
Simon Cruanes
703ffde303
add No_runner: a runner that doesn't do anything in the background
...
The idea is that you might have APIs that want a runner, but the work is
too trivial to require a full actual thread pool. In this case use
`No_runner.runner` and calls to `run_async runner f` will turn into `f()`.
2023-10-28 12:33:16 -04:00
Simon Cruanes
f6a2e9a0ad
feat: add Moonpool.recommended_thread_count
2023-10-28 12:29:25 -04:00
Simon Cruanes
37f8c1059c
perf: also use the main domain, along with n-1 other ones
...
we always keep a thread alive on the main domain as a worker for new
tasks, but other domains can still come and go to manage resources
properly in case a pool is started and used only for a short while.
2023-10-28 11:59:20 -04:00
Simon Cruanes
def384b4f8
fix warning
2023-10-27 16:18:24 -04:00
Simon Cruanes
052b70027a
compat 4.08
2023-10-27 16:17:56 -04:00
Simon Cruanes
bfcf7f774e
chore: handpick combinations for bench-pi
2023-10-27 16:16:49 -04:00
Simon Cruanes
ddf394be90
chore: handpick set of benchmarks
2023-10-27 16:06:55 -04:00
Simon Cruanes
aba0d84ecf
ws pool: random stealing; rework main state machine
...
in the state machine, after waiting, we check the main queue, else we
directly go to stealing.
2023-10-27 16:05:52 -04:00
Simon Cruanes
aa7906eb2c
perf TLS: inline
2023-10-27 16:05:43 -04:00
Simon Cruanes
e67bffeca5
ws_pool: use TLS for quick worker storage access; reduce contention
2023-10-27 15:18:50 -04:00
Simon Cruanes
b4ddd82ee8
ws pool: use non atomic boolean to reduce number of wakeups; refactor
2023-10-27 14:48:13 -04:00
Simon Cruanes
359ec0352b
small change to test
2023-10-27 14:47:59 -04:00
Simon Cruanes
68fe7221b8
suspend: remove additional parameter, always run tasks in handler
2023-10-27 14:47:54 -04:00
Simon Cruanes
9e0a583a94
chore: disable -dl/-seq benchs for now, too verbose
2023-10-27 14:46:59 -04:00
Simon Cruanes
c044fb8fc9
tweal to WS pool
2023-10-27 12:26:50 -04:00
Simon Cruanes
08722691e8
ws deque: try to reduce false sharing
2023-10-27 12:26:43 -04:00
Simon Cruanes
9e93ebd3bb
update benchmark fib-rec with more implementations
2023-10-27 12:26:03 -04:00
Simon Cruanes
5409cf8e1b
compat 4.08
2023-10-25 23:50:34 -04:00
Simon Cruanes
3e614ec992
rename Pool to Ws_pool; deprecated Moonpool.Pool
2023-10-25 23:43:18 -04:00
Simon Cruanes
30035fa67d
fix pool: suspension handler might run from a different thread!
...
this means we can't reuse the same worker state, it's neither thread
safe nor deadlock-safe (the worker whose state it is might be waiting on
the main queue)
2023-10-25 23:30:04 -04:00
Simon Cruanes
1e3629bc67
fix ws_deque: strict bound for shrinking
2023-10-25 23:29:47 -04:00
Simon Cruanes
629b66662f
fix ws_deque: circular array is also in an atomic
2023-10-25 23:18:47 -04:00
Simon Cruanes
1ed25e5aca
test: make t_ws_deque consume less ram
2023-10-25 22:41:26 -04:00
Simon Cruanes
dfb588cdc5
test: update readme
2023-10-25 22:41:18 -04:00
Simon Cruanes
056986c84f
perf pool: no retries for self-queue; fewer retries for stealing
2023-10-25 22:38:43 -04:00
Simon Cruanes
e937bf0e9d
perf pool: restore non-hashtable lookup for self-queuing
2023-10-25 22:38:35 -04:00
Simon Cruanes
3956fb6566
fix ws_pool: no work stealing for pools of 1 worker
...
there would be a loop because it'd try to find the index of another
worker to steal from, but loop forever because there is no other worker.
2023-10-25 22:33:08 -04:00
Simon Cruanes
d9da7844e2
test: run more diverse pools in t_fib_rec
2023-10-25 22:32:57 -04:00
Simon Cruanes
894851f6e8
comments in ws_deque
2023-10-25 22:32:42 -04:00
Simon Cruanes
530507d84e
fix fifo_pool: raise Shutdown, not Closed, in run
2023-10-25 22:11:08 -04:00
Simon Cruanes
3f720241b2
feat pool: use Shutdown when running a task after it's closed
2023-10-25 22:10:10 -04:00
Simon Cruanes
9a1309c44f
chore: add keywords in opam
2023-10-25 22:03:35 -04:00
Simon Cruanes
a89c0ce4f2
breaking: make Runner.t abstract
2023-10-25 21:59:22 -04:00
Simon Cruanes
6452ca89d1
rename Simple_pool into Fifo_pool, update doc
2023-10-25 21:55:29 -04:00
Simon Cruanes
db33bec13f
wip: better work stealing pool
2023-10-25 12:11:41 -04:00
Simon Cruanes
e0d3a18562
improve test a bit
2023-10-25 09:57:25 -04:00
Simon Cruanes
fdc188c291
wip: debug pool
2023-10-25 09:57:19 -04:00
Simon Cruanes
3d7e272d01
perf ws_deque: use bitmasks instead of modulo op
2023-10-25 09:57:05 -04:00
Simon Cruanes
78407c495d
more tests for WS_deque
2023-10-25 09:56:56 -04:00
Simon Cruanes
078adae786
limit CI time
2023-10-25 09:28:18 -04:00
Simon Cruanes
91c0c3f6c1
fix props
2023-10-25 01:01:51 -04:00
Simon Cruanes
ef05146e03
tweak retry thresholds in pool
2023-10-25 00:28:19 -04:00