From ec95d1c83fbbefb77d65aab2eaa2c53500829f83 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Thu, 22 May 2025 16:58:03 +0200 Subject: [PATCH] rely more on the cache --- compiler/lib/inline.ml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/lib/inline.ml b/compiler/lib/inline.ml index fc14c81c2e..cb9ac9de2e 100644 --- a/compiler/lib/inline.ml +++ b/compiler/lib/inline.ml @@ -242,8 +242,13 @@ let rec block_size ~recurse ~context { branch; body; _ } = ~f:(fun n i -> match i with | Event _ -> n - | Let (_, Closure (_, (pc, _), _)) -> - if recurse then size ~recurse ~context pc + n + 1 else n + 1 + | Let (f, Closure (_, (pc, _), _)) -> + if recurse + then + match Var.Map.find f context.env with + | exception Not_found -> size ~recurse ~context pc + n + 1 + | info -> cache ~info info.full_size (size ~recurse:true ~context) + n + 1 + else n + 1 | _ -> n + 1) ~init: (match branch with