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
Perf #20
Perf #20
Conversation
Do we need to phase out julia < 1.3 here? |
We may not have to. Some tests fail because I sometimes use What I understand less well is why qp = @test_logs(
# These logs must appear in exactly this order
(:info, "Problem name : QP example"),
(:info, "Objective sense : notset"),
(:info, "Objective name : obj"),
(:info, "RHS : rhs1"),
(:info, "RANGES : nothing"),
(:info, "BOUNDS : bnd1"),
match_mode = :all,
readqps("dat/qp-example.qps")
) results in |
Looks like the culprit is ranges_section_read && @info("RANGES : $(qpsdat.rngname)") The following will error in Julia1.0 but not in 1.3: x = nothing
@info "$x" This can happen if the Two remedies:
if qps.rngname === nothing
# Record this as the RANGES
qps.rngname = rng
@info "Using $rng at line $(card.line) as RANGES name" |
Codecov Report
@@ Coverage Diff @@
## master #20 +/- ##
=========================================
- Coverage 78.32% 77.5% -0.82%
=========================================
Files 2 2
Lines 429 369 -60
=========================================
- Hits 336 286 -50
+ Misses 93 83 -10
Continue to review full report at Codecov.
|
I'm happy to drop Julia < 1.3. |
The latest commit works on Julia 1.0 - 1.4 (latter tested locally), so dropping < 1.3 is not necessary (and 1.0 is long-term supported). That can always be changed later |
Do we need something else before this can be merged? |
No, thanks a lot. Sorry for the latency. |
Basically a close-to-full re-write, with major performance improvements (see below).
The diff will be horrible, since virtually no line was left untouched.
The main differences are as follows:
MPSCard
structure for extracting fields. Not all fields are always strings or always numbers, so only strings are extracted.I then replaced
read_XXX_section
withread_XXX_line
, which only handles the parsing of fields, which shortens the functions and removes a lot of duplicate code.This approach should make it (much) easier to support Free MPS format, since only the
read_card!
function will have to be modifiedQPSData
object is created at the beginning ofreadqps
, and modified in-place. This saves a lot of memoryOther minors differences:
RANGES
section is read before theRHS
section. This is because, in absence of anRHS
section, all right-hand sides are assumed to be zero.However, an error is thrown if
RANGES
appears beforeRHS
.@warn
for the first time a rim field is detected. Instead, a@error
log is displayed every time such data is encountered. Tests were updated accordingly.Compared to the master branch, ~75% decrease in time, and ~85% decrease in memory:
["maros"]
["netlib"]
Other solvers do not read
.SIF
files, so explicit comparison is not possible on this testset.Nevertheless, reading all NETLIB instances (which I manually converted to MPS) with Gurobi (through its Julia API) takes ~1.5s, compared to ~6s for QPSReader.