Repository navigation
Fix precompilation of MOI.delete(model, x) - #3126
Merged
Merged
Conversation
Member
Author
|
Before julia> import MathOptInterface as MOI
julia> @time begin
model = MOI.Utilities.Model{Float64}()
x = MOI.add_variable(model)
for i in 1:3
MOI.add_constraint(model, 1.0 * x, MOI.GreaterThan(sin(i)))
end
@time MOI.delete(model, x)
end
14.950712 seconds (45.77 M allocations: 2.307 GiB, 2.46% gc time, 100.00% compilation time)
14.959136 seconds (45.77 M allocations: 2.307 GiB, 2.46% gc time, 100.00% compilation time)
julia> @time begin
model = MOI.Utilities.Model{Float64}()
x = MOI.add_variable(model)
for i in 1:3
MOI.add_constraint(model, 1.0 * x, MOI.GreaterThan(sin(i)))
end
@time MOI.delete(model, x)
end
0.000006 seconds (19 allocations: 832 bytes)
0.000119 seconds (134 allocations: 6.594 KiB)After julia> import MathOptInterface as MOI
julia> @time begin
model = MOI.Utilities.Model{Float64}()
x = MOI.add_variable(model)
for i in 1:3
MOI.add_constraint(model, 1.0 * x, MOI.GreaterThan(sin(i)))
end
@time MOI.delete(model, x)
end
0.020555 seconds (78.89 k allocations: 4.176 MiB, 99.71% compilation time)
0.028824 seconds (80.25 k allocations: 4.240 MiB, 98.74% compilation time)
julia> @time begin
model = MOI.Utilities.Model{Float64}()
x = MOI.add_variable(model)
for i in 1:3
MOI.add_constraint(model, 1.0 * x, MOI.GreaterThan(sin(i)))
end
@time MOI.delete(model, x)
end
0.000015 seconds (25 allocations: 960 bytes)
0.000130 seconds (140 allocations: 6.719 KiB) |
Member
Author
julia> import MathOptInterface as MOI
julia> @time begin
model = MOI.Utilities.Model{Float64}()
x = MOI.add_variable(model)
for i in 1:3
MOI.add_constraint(model, 1.0 * x, MOI.GreaterThan(sin(i)))
end
@time MOI.delete(model, x)
end
0.068279 seconds (154.22 k allocations: 7.852 MiB, 99.85% compilation time)
0.076540 seconds (155.57 k allocations: 7.916 MiB, 99.48% compilation time)
julia> @time begin
model = MOI.Utilities.Model{Float64}()
x = MOI.add_variable(model)
for i in 1:3
MOI.add_constraint(model, 1.0 * x, MOI.GreaterThan(sin(i)))
end
@time MOI.delete(model, x)
end
0.000012 seconds (28 allocations: 992 bytes)
0.000112 seconds (143 allocations: 6.750 KiB)So this PR is a clear win over that. |
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.
Closes #3124
Closes #3125
In a fresh session: