From f94a61e7dc6f635f3944a07170e1222fa8f6c431 Mon Sep 17 00:00:00 2001 From: Vesa Karvonen Date: Mon, 21 Aug 2023 10:04:57 +0300 Subject: [PATCH] Avoid allocation in no-op update --- src/kcas/kcas.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/kcas/kcas.ml b/src/kcas/kcas.ml index 799e12cc..7fd20dcf 100644 --- a/src/kcas/kcas.ml +++ b/src/kcas/kcas.ml @@ -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