Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speedup quicksave (up to x2) by limiting ui_manager::redraw() rate #45634

Merged
merged 1 commit into from
Nov 26, 2020

Conversation

Aivean
Copy link
Contributor

@Aivean Aivean commented Nov 25, 2020

Summary

SUMMARY: Performance "Speedup quicksave (mapbuffer::save) by limiting ui_manager::redraw() rate"

Purpose of change

While profiling auto-/quicksave I noticed that 50% of time is spent in ui_manager::redraw().

Describe the solution

Change the ui_manager::redraw(); invocation to be time-based (every ½ second, similar to waiting/crafting) instead of counter-based.

Describe alternatives you've considered

Limit the current counter-based UI refresh rate. Seems like a worse alternative: counter could be tuned only to a single specific scenario (number of submaps that actually need to be saved, submap saving time), while time-based approach always work as designed.

Testing

Manually playtested using quicksave.

Additional context

Profiling:
Before:
image

After:
image

Demo:
Before:
save1

After:
save2

@Aivean Aivean added [C++] Changes (can be) made in C++. Previously named `Code` Code: Performance Performance boosting code (CPU, memory, etc.) Map / Mapgen Overmap, Mapgen, Map extras, Map display labels Nov 25, 2020
@Night-Pryanik
Copy link
Contributor

Praise @Aivean!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Performance Performance boosting code (CPU, memory, etc.) Map / Mapgen Overmap, Mapgen, Map extras, Map display
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants