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

Don't save registry when opening settings #3058

Merged
merged 3 commits into from
May 20, 2020

Conversation

DasSkelett
Copy link
Member

Motivation

I recently noticed that opening the settings window is pretty slow from time to time. When profiling it, I found out that we save the registry on settings startup, and it seems to be the culprit (the serialization, to be precise).

Problem

In RefreshReposListBox>(), the registry is saved after the we sort the list of repositories in the registry to how they are sorted in the GUI.
This is also done when the settings are just opened. In this case there are no repositories listed in the GUI (and the user couldn't have changed the sorting yet), so the whole operation is not doing anything.
However we still save the registry afterwards, which takes a long time.

Changes

THe costly operation is put behind an if-clause. When _sortedRepos.Count == 0, we just pull the list of repositories from the registry (needed to build the list for the GUI later), but jump over all the sorting and saving stuff.

@DasSkelett DasSkelett added Enhancement New features or functionality Easy This is easy to fix GUI Issues affecting the interactive GUI Pull request labels May 19, 2020
@DasSkelett DasSkelett requested a review from HebaruSan May 19, 2020 09:44
@DasSkelett
Copy link
Member Author

DasSkelett commented May 19, 2020

Added another commit that skips saving the registry in KSP.ScanGameData() if nothing changes, that is when dllChanged and dlcChanged are false.

Should help reducing the amount of files in the KSP/CKAN/history folder.

@HebaruSan
Copy link
Member

This is great. I think we can get it to be instantaneous with the changes in DasSkelett#8.

@HebaruSan HebaruSan merged commit e725909 into KSP-CKAN:master May 20, 2020
@DasSkelett DasSkelett deleted the impr/faster-settings branch May 20, 2020 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy This is easy to fix Enhancement New features or functionality GUI Issues affecting the interactive GUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants