Very slow performance when modifying and querying a model with JuMP

instead of keeping additional data structures

You should keep additional data structures, or query the constraint function once.

JuMP does to have O(1) access to the constraint coefficients.