Skip to content

Don't show progress bar for "save scene" < 1s

Bernhard Liebl requested to merge github/fork/poke1024/progress_delay_show into master

EditorNode::_save_scene_with_preview currently takes about 500 ms on my iMac (optimized build).

About 40% of that time is spent in ui code (displaying the progress bar and handling other ui events in Main::iteration()). If I disable the progress bar display during save, the time goes down to about 320 ms.

So I suggest hiding the progress bar if the save takes less than 1s, since:

(a) on many systems, the save progress bar is merely a flicker (like 100 ms) and a bit annoying IMHO (b) showing the progress bar substantially increases the save scene time, and as such the time to start the runner during game development (c) the save progress bar cannot be cancelled and so there is nothing lost if the ui gets unresponsive during save for up to 1s

Here are some concrete measurements of EditorNode::_save_scene_with_preview in milliseconds. Before the change:

_save_scene_with_preview 549
_save_scene_with_preview 514
_save_scene_with_preview 485
_save_scene_with_preview 481
_save_scene_with_preview 538
_save_scene_with_preview 474
_save_scene_with_preview 470
_save_scene_with_preview 456
_save_scene_with_preview 538

After the change:

_save_scene_with_preview 353
_save_scene_with_preview 324
_save_scene_with_preview 308
_save_scene_with_preview 345
_save_scene_with_preview 321
_save_scene_with_preview 306
_save_scene_with_preview 332

This PR checks on each progress step if 1s has passed; if not, the progress bar is not yet shown. It's only affecting scene save. All other progress bars still default to "show immediately" (current behavior).

Merge request reports

Loading