It would be helpful if you could isolate which part of the code is taking a long time. How log does it take if you comment out optimize!(model) onwards?
optimize!(model)
"You should look at your memory usage as the program is running.” How could I do this?