Skip to content

Commit

Permalink
refactor(fiber): optimize ivar
Browse files Browse the repository at this point in the history
Remove pattern match and function call when filling empty ivars

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

ps-id: a9642d29-4f12-401b-88f4-5ef7f7e2078d
  • Loading branch information
rgrinberg committed Jul 28, 2022
1 parent 165b42e commit ebc46c5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/fiber/scheduler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ module Jobs = struct
let fill_ivar ivar x jobs =
match ivar.state with
| Full _ -> failwith "Fiber.Ivar.fill"
| (Empty | Empty_with_readers _) as readers ->
| Empty ->
ivar.state <- Full x;
jobs
| Empty_with_readers _ as readers ->
ivar.state <- Full x;
enqueue_readers readers x jobs

Expand Down

0 comments on commit ebc46c5

Please sign in to comment.