This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Switched Locale
deprecation maps to jumptables and fixed minor bug with deprecated countries
#33123
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.
Locale
where deprecated countries would return all the same data, but the would not be considered==
const Map
data representing the deprecated languages and countries to jump tables. In microbenchmarks it behaves 2x faster in jit x64.==
operator to prefer less lookup calls to deprecated tables.I made this change because
Locale
is sometimes used as a key into a map, as it is in Flutter gallery. When it is used in a Map it'shashCode
is calculated, which is based on the country code and the language code, which requires lookups into these maps. I tried to memoize the values and the hashCode, but because of the limitations of Dart I couldn't do that (dart-lang/sdk#48948).The reason I identified this as a potential performance fix is that I setup Flutter to continuously build frames and navigated through the Material section of Flutter gallery and noticed that

Locale.hashCode
shows up pretty high. I also saw other Flutter users in Google using Locale as a key.Note:
customer: money
.Pre-launch Checklist
writing and running engine tests.
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.