Skip to content

Conversation

@blegat
Copy link
Member

@blegat blegat commented May 7, 2024

@profview showed quite clearly that all the time was taken by allocating new empty vectors in these three lines:

sd_row = Vector{Int32}[Int32[] for i in 1:length(m.sd_dim)]
sd_col = Vector{Int32}[Int32[] for i in 1:length(m.sd_dim)]
sd_coef = Vector{Float64}[Float64[] for i in 1:length(m.sd_dim)]

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 #135

@blegat blegat force-pushed the bl/split_matrix branch from d907a42 to d0e17e0 Compare May 7, 2024 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Slow read_from_file for .cbf files containing SDP constraints

2 participants