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 Progress Bar #34

Merged
merged 1 commit into from
Dec 4, 2021
Merged

Speedup Progress Bar #34

merged 1 commit into from
Dec 4, 2021

Conversation

mitchej123
Copy link
Contributor

Every .step() function on ProgressBar calls stripSpecialChars because the rendering doesn't support some UNICODE.

StripSpecialChars calls CharMatcher.anyOf(ALLOWED_CHARS) on every invocation, which does a bunch of allocations, sorting, etc. This wasn't a big deal on Vanilla, or other mods because they're not spamming thousands of materials on the progress bar.
The obvious solution would be just... don't call this at all, and that might be safe for English Locales... but given strings sent to the progress bar might be localized, we instead backport the behavior from later forge versions which cache a static copy of DISALLOWED_CHAR_MATCHER and use that, instead of creating a new one on every function call.

…se the rendering doesn't support some UNICODE.

StripSpecialChars calls `CharMatcher.anyOf(ALLOWED_CHARS)` on every invocation, which does a bunch of allocations, sorting, etc.  This wasn't a big deal on Vanilla, or other mods because they're not spamming thousands of materials on the progress bar.
The obvious solution would be just... don't call this at all, and that might be safe for English Locales... but given strings sent to the progress bar might be localized, we instead backport the behavior from later forge versions which cache a static copy of `DISALLOWED_CHAR_MATCHER` and use that, instead of creating a new one on every function call.
@mitchej123 mitchej123 requested a review from a team December 4, 2021 05:44
@Dream-Master Dream-Master merged commit 543487a into master Dec 4, 2021
@Dream-Master Dream-Master deleted the progressbar_speedup branch December 4, 2021 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants