From 7816c76de8a59a25a5f5305e6d6b8fd3cd5fa574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Thu, 29 Oct 2026 17:57:01 +0100 Subject: [PATCH] Workaround slow inference for deletion --- src/Utilities/struct_of_constraints.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Utilities/struct_of_constraints.jl b/src/Utilities/struct_of_constraints.jl index a376e24388..c9c457ef14 100644 --- a/src/Utilities/struct_of_constraints.jl +++ b/src/Utilities/struct_of_constraints.jl @@ -32,10 +32,16 @@ function final_touch(model::StructOfConstraints, index_map) return end +# Avoid compiling the recursive deletion passes for constraint containers that +# are not present in the model. function _throw_if_cannot_delete(model::StructOfConstraints, vis, fast_in_vis) broadcastcall(model) do constrs if constrs !== nothing - _throw_if_cannot_delete(constrs, vis, fast_in_vis) + _throw_if_cannot_delete( + Base.inferencebarrier(constrs), + vis, + fast_in_vis, + ) end return end @@ -49,7 +55,7 @@ function _deleted_constraints( ) broadcastcall(model) do constrs if constrs !== nothing - _deleted_constraints(callback, constrs, vi) + _deleted_constraints(callback, Base.inferencebarrier(constrs), vi) end return end