MosekTools.jl
MosekTools.jl copied to clipboard
Improve performance of split_scalar_matrix
@profview
showed quite clearly that all the time was taken by allocating new empty vectors in these three lines:
https://github.com/jump-dev/MosekTools.jl/blob/650846dc4869a9eb4c1f0be33b74d09aa7c4bfb8/src/constraint.jl#L54-L56
On @mipals benchmark ..._446.cbf
:
function bench(n)
file = "..._$n.cbf"
model = @time JuMP.read_from_file(file)
@time set_optimizer(model, Mosek.Optimizer)
@time MOI.Utilities.attach_optimizer(backend(model))
end
bench(446)
Before the PR:
1.203168 seconds (10.11 M allocations: 451.678 MiB, 4.00% gc time)
0.000813 seconds (2.10 k allocations: 46.250 KiB)
7.068828 seconds (282.64 M allocations: 18.978 GiB, 12.78% gc time)
After the PR:
1.185881 seconds (10.11 M allocations: 451.678 MiB, 3.66% gc time)
0.000877 seconds (2.10 k allocations: 46.250 KiB)
0.074850 seconds (1.10 M allocations: 101.496 MiB, 7.87% gc time)
Closes https://github.com/jump-dev/MosekTools.jl/issues/135