rust-or / lp-solvers

library implementing interaction with various linear programming solvers
https://docs.rs/lp-solvers/
MIT License
19 stars 9 forks source link

Improve performance when writing lp and reading sol files #9

Closed mbiggio closed 6 months ago

mbiggio commented 6 months ago

We improve the performance of the solution file parser in the case of cplex, by making use of the more performant quick-xml crate and buffering the reads through BufReader. quick-xml indeed requires the reader to be buffered, probably to avoid making too many read syscalls.

Buffering is also applied to writing the lp file. Manual benchmarks are showing significant improvements over non-buffered read/writes for problem sizes of several thousands of variables

mbiggio commented 6 months ago

Lemme know if it might be worth adding some specific benchmark, maybe with some non-trivial .sol file to parse.

Anyway, just to provide some numbers, on my machine (Intel i5 processor, 10 cores, 32 GB RAM), solving a problem with:

takes:

so a considerable amount of time was spent in IO, and this IO time is probably going to be proportional to the problem size

lovasoa commented 6 months ago

Merged; thank you!

mbiggio commented 6 months ago

Merged; thank you!

You're welcome!