Repository navigation
Conversation
Member
|
The other option is diff --git a/src/Utilities/struct_of_constraints.jl b/src/Utilities/struct_of_constraints.jl
index a376e2438..9f28b9d7b 100644
--- a/src/Utilities/struct_of_constraints.jl
+++ b/src/Utilities/struct_of_constraints.jl
@@ -33,12 +33,11 @@ function final_touch(model::StructOfConstraints, index_map)
end
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)
- end
- return
+ function inner(@nospecialize constrs)
+ return _throw_if_cannot_delete(constrs, vis, fast_in_vis)
end
+ inner(::Nothing) = nothing
+ broadcastcall(inner, model)
return
end
@@ -47,12 +46,11 @@ function _deleted_constraints(
model::StructOfConstraints,
vi,
)
- broadcastcall(model) do constrs
- if constrs !== nothing
- _deleted_constraints(callback, constrs, vi)
- end
- return
+ function inner(@nospecialize constrs)
+ return _deleted_constraints(callback, constrs, vi)
end
+ inner(::Nothing) = nothing
+ broadcastcall(inner, model)
return
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem with deletion is that we have 219 possible function/set
VectorOfConstraintscontainers and even thought they are empty we still need to compile the methods for them to delete variables in their functions.There is a runtime tradeoff: with three tiny constraints, warmed deletion increased from 0.19 to 0.97 μs, allocating 432 additional bytes per deletion.
Closes #3124