From 3fc3a58dfd4e4feec9c2d9e66d5056b79ef87b2b Mon Sep 17 00:00:00 2001 From: perf-bundle Date: Thu, 3 Sep 2026 15:29:25 +0200 Subject: [PATCH] [MicroPerf] Drop the per-call closure in generic type-argument codegen GenTypeArgsAux fed the partial application `GenTypeArgAux cenv m tyenv` to List.map, so every IL generic type-instantiation heap-allocated the mapping closure (ilTypeInst@655, 21.9 MB sampled) on one of the hottest codegen paths. ListInline.map folds the mapping in, so nothing is allocated per instantiation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/Compiler/CodeGen/IlxGen.fs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index ceeec0a69ec..ae028f41cd4 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -639,7 +639,8 @@ let rec GenTypeArgAux cenv m tyenv tyarg = GenTypeAux cenv m tyenv VoidNotOK PtrTypesNotOK tyarg and GenTypeArgsAux cenv m tyenv tyargs = - List.map (GenTypeArgAux cenv m tyenv) (DropErasedTyargs tyargs) + DropErasedTyargs tyargs + |> ListInline.map (fun tyarg -> GenTypeArgAux cenv m tyenv tyarg) and GenTyAppAux cenv m tyenv repr tinst = match repr with