Drastically improve loading speed of the settings page #2452
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Drastically improve loading speed of the settings page
Pull Request Type
Please select what type of pull request this is:
Description
This pull request fixes the slow loading of the settings page by only loading the language list once, instead of the 45 times it does it at the moment (once outside of the loop and once for each language inside the loop). As the list of language names is also regenerated when you choose a different language, this change also speeds up that as well.
Illustration of what it feels like to open the settings page now:
Screenshots (if appropriate)
Here is how long it takes to generate the list of language names with and without this change. The numbers are in milliseconds.
Testing (for code that is not small enough to be easily understandable)
Open the settings page and change language. You will definitely notice the difference, if you don't then your computer is too fast (I would definitely like to borrow it at some point).
Desktop (please complete the following information):