Efficient linear algebra for large-scale problems in JuMP

Ah, that explains a lot thanks. In particular, I was missing two huge pieces of the picture:

  • I was missing the significance of sizehint!, it seems that it can drastically improve performants in many of the worst cases. By the way, is there some reason there is no size hint in _dot, I kept looking at that function and kept thinking that nothing else had it either.
  • Having seen all of the operator overloading, I didn’t think that the macros were really doing anything most of the time.

I know this is a bit of a loaded question, but could you perhaps give a very brief description of what extra steps are happening in the macros that don’t just come from the operator overloading (your YouTube talk actually made it seem like most of what you’d do in the macro is implemented in the operator overloading)? As a concrete example, I often have problems where I need to do something like

A*x*B

where A<:AbstractMatrix{<:Number}, B<:AbstractMatrix{<:Number}, x<:AbstractSparseMatrix{JuMP.Variable}. I usually wind up writing an explicit function to make these tractable, but I’ve always timed it against operations I do outside of macros. Would something different happen in an expression like this within a macro? (It’s just so much harder for me to understand the macro code than the operator code, so I don’t think I understand what’s going on there at all.)