Skip to content

Commit f6c3703

Browse files
committed
pass-by-ref to avoid expensive copying of matrix for every constraint while writing LP Model - gives 10x faster LP model writes for large models (20M nz)
1 parent bb3b262 commit f6c3703

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

highs/io/FilereaderLp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ void FilereaderLp::writeToFileVar(FILE* file, const std::string var_name) {
343343
}
344344

345345
void FilereaderLp::writeToFileMatrixRow(FILE* file, const HighsInt iRow,
346-
const HighsSparseMatrix ar_matrix,
347-
const std::vector<string> col_names) {
346+
const HighsSparseMatrix& ar_matrix,
347+
const std::vector<string>& col_names) {
348348
assert(ar_matrix.isRowwise());
349349

350350
for (HighsInt iEl = ar_matrix.start_[iRow]; iEl < ar_matrix.start_[iRow + 1];

highs/io/FilereaderLp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class FilereaderLp : public Filereader {
4242
const bool force_plus = true);
4343
void writeToFileVar(FILE* file, const std::string var_name);
4444
void writeToFileMatrixRow(FILE* file, const HighsInt iRow,
45-
const HighsSparseMatrix ar_matrix,
46-
const std::vector<string> col_names);
45+
const HighsSparseMatrix& ar_matrix,
46+
const std::vector<string>& col_names);
4747
};
4848

4949
#endif

0 commit comments

Comments
 (0)