Each successive run of JuMP in VS Code gets slower

While using VS Code to run a Julia (JuMP) optimization model (using Gurobi for the optimization), I’ve noticed that each subsequent run I do of the program (even if I make no changes in it) takes longer.

The run times for a particular optimization program are:
Run #1: 7.5 mins (immediately following VS Code startup)
Run #2: 15.4 mins
Run #3: 24.9 mins

I made no changes in the program – I simply pressed the “Execute active file in REPL” button for each run.

Has anyone else experienced this? Is it more likely to be an issue with Gurobi or VS Code? Is there some memory or result cache that needs to be cleared?

I also wonder if it has something to do with the way I’ve written the optimization program.

(The JuMP model is defined within a for loop, and the model is optimized within that loop – and the model is written over again with each pass of the for loop. Could the model definitions somehow be accumulating?)

Thanks in advance!

Hi @Anjinsan! Could you maybe share an MWE to help us help you? In my opinion it’s likely that you have some leak in your code that causes the problem to grow in size every time you run it. Have you tried running it several times in a fresh REPL to confirm that the duration doesn’t increase?

1 Like

Hi @gdalle,
Thank you for your reply. Following your suggestion, I tried running it in a fresh REPL – and indeed the duration does not increase.
I tried making an minimum working example, but my pared-down problem doesn’t exhibit the same problem. Maybe I should start out with that example, and gradually add complexity (while testing it each step)… Thanks again!