From 59b04b1fed0d4639fa16b7f3ec914190fe28042d 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/kcas/kcas.ml b/src/kcas/kcas.ml index 2fcd84e1..4c3c1285 100644 --- a/src/kcas/kcas.ml +++ b/src/kcas/kcas.ml @@ -784,7 +784,10 @@ module Xt = struct end else let current = state_r.after in - let state = State { state_r with after = f current } in + let after = f current in + let state = + if current == after then state else State { state_r with after } + in xt.cass <- Cas { loc; state; lt; gt; awaiters = [] }; current