CVX solution speed vs linprog or quadprog

I have an optimization problem, which i have solved with matlab functions linprog and quadprog. Quadprog is little faster than the linprog but overall they both (solvers) give me solution within 20 msec. Whereas when i solved my problem through CVX, it took lot of time and give me solution in 600 msec. The detailed timings are

Pre=7.2e-2 IPM-2.031e-1 Post=3.12e-2

Please! help me where i can find the details of these above timings and why my problem take so much time through CVX.


There are two reasons CVX is slower here.

First of all, the modeling layer provided by CVX imposes a certain amount of overhead. Some of that overhead remains no matter how small the problem is. Some of it scales with problem size. For problems as small as yours, the fixed overhead is going to be a significant cost.

Secondly, the solvers CVX uses solve a much wider variety of problems than linprog and quadprog. As a general principle, the more specialized the solver, the faster it can be. For instance, the CVX solvers can be used to solve simple least-squares problems, but I certainly would not recommend that.

To be frank, this is just the cost of using CVX. CVX is not built for raw computational speed; it is built for modeling convenience. Now for most people, 600 milliseconds simply isn’t an issue. But since it is for you, and since just the solver alone is 10 times slower than the other solvers, it seems to me that you are simply going to have to use linprog or quadprog for your application.

(That said, you might want to give Gurobi or MOSEK a try, too. That is, call them directly instead of through CVX. They should be faster than linprog or quadprog for virtually any size problem.)