Skip to content

Commit

Permalink
refactor(fiber): optimize reader enqueue
Browse files Browse the repository at this point in the history
we know that case [Empty_with_readers] has at least one job to enqueue,
so we enqueue it manually ourselves before enqueuing the rest.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

ps-id: de9dbcec-fc09-426c-a9e2-811f5f38f430
  • Loading branch information
rgrinberg committed Aug 12, 2022
1 parent 43a5302 commit 912a314
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/fiber/scheduler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ module Jobs = struct
| Empty ->
ivar.state <- Full x;
jobs
| Empty_with_readers _ as readers ->
| Empty_with_readers (ctx, k, readers) ->
ivar.state <- Full x;
let jobs = Job (ctx, k, x, jobs) in
enqueue_readers readers x jobs

let rec exec_fills fills acc =
Expand Down

0 comments on commit 912a314

Please sign in to comment.