Skip to content

Commit

Permalink
Avoid allocation in no-op update
Browse files Browse the repository at this point in the history
  • Loading branch information
polytypic committed Jan 14, 2024
1 parent 0228553 commit 49dcec2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/kcas/kcas.ml
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,8 @@ module Xt = struct
end
else
let current = state.after in
let state = { state with after = f current } in
let after = f current in
let state = if current == after then state else { state with after } in
tree_as_ref xt := T (Node { loc; state; lt; gt; awaiters = [] });
current

Expand Down

0 comments on commit 49dcec2

Please sign in to comment.