From 49dcec24c6e0c5600285a1acbfc23a8fac16b37d 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 32f7b7a8..1769b303 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