Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of split_scalar_matrix #136

Merged
merged 1 commit into from
Nov 21, 2024
Merged

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
@blegat blegat merged commit 3ff7f08 into master Nov 21, 2024
2 checks passed
@blegat blegat deleted the bl/split_matrix branch November 21, 2024 10:37
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
1 participant