What platform are you targeting? Can you use a
Future, or other tool to run in a background thread?
Otherwise, yes, if it’s resource intensive, you will need to sleep somewhere in order to give the renderer a chance to redraw. It should redraw consistently, but it will be up to your code how often, and with what value, you show in your progress bar