In the last 10 years (see this post) when I want to track the result of a longer calculation, I use the following pattern:
SetAttributes[progressBar,HoldFirst]
progressBar[i_,total_]:= Module[{},
Echo@Dynamic@Row[
{ProgressIndicator[i,{0,total}]," ",NumberForm[100.i/total,{\[Infinity],2}],"% ",i}
]
]
so I can monitor a function as follows, using progressBar
progressExample[data_List]:= Module[{i = 0,len = Length@data},
progressBar[i,len];
Scan[(i++;Pause[0.1];f[#])&,data]
]
progressExample[Range[10]]
The problem is that this code crashes for long runs, I think because of the use of Dynamic. Some idea for a better way to do that? Any suggestions for a more modern or native solution?
Dynamic
in some way. So if you are experiencing crashes that you want to prevent, we'll need some kind of example to reproduce them. $\endgroup$ResourceFunction["MonitorProgress"]
? $\endgroup$