8283324: CLDRConverter run time increased by 3x
Reviewed-by: ihse
This commit is contained in:
parent
ec4fb47b90
commit
f6e9ca0cbe
@ -847,19 +847,24 @@ public class CLDRConverter {
|
||||
"DateTimePatternChars",
|
||||
"PluralRules",
|
||||
"DayPeriodRules",
|
||||
"DateFormatItem",
|
||||
"DateFormatItemInputRegions.allowed",
|
||||
"DateFormatItemInputRegions.preferred",
|
||||
};
|
||||
|
||||
static final Set<String> availableSkeletons = new HashSet<>();
|
||||
|
||||
private static Map<String, Object> extractFormatData(Map<String, Object> map, String id) {
|
||||
Map<String, Object> formatData = new LinkedHashMap<>();
|
||||
for (CalendarType calendarType : CalendarType.values()) {
|
||||
String prefix = calendarType.keyElementName();
|
||||
Arrays.stream(FORMAT_DATA_ELEMENTS)
|
||||
.flatMap(elem -> map.keySet().stream().filter(k -> k.startsWith(prefix + elem)))
|
||||
.forEach(key -> {
|
||||
.forEach(elem -> {
|
||||
var key = prefix + elem;
|
||||
copyIfPresent(map, "java.time." + key, formatData);
|
||||
copyIfPresent(map, key, formatData);
|
||||
});
|
||||
availableSkeletons.forEach(s ->
|
||||
copyIfPresent(map, prefix + "DateFormatItem." + s, formatData));
|
||||
}
|
||||
|
||||
for (String key : map.keySet()) {
|
||||
|
@ -768,9 +768,14 @@ class LDMLParseHandler extends AbstractLDMLHandler<Object> {
|
||||
case "dateFormatItem":
|
||||
{
|
||||
// for FormatData
|
||||
prefix = (currentCalendarType == null) ? "" : currentCalendarType.keyElementName();
|
||||
pushStringEntry(qName, attributes,
|
||||
prefix + Bundle.DATEFORMATITEM_KEY_PREFIX + attributes.getValue("id"));
|
||||
if (currentCalendarType != null) {
|
||||
var skeleton = attributes.getValue("id");
|
||||
CLDRConverter.availableSkeletons.add(skeleton);
|
||||
pushStringEntry(qName, attributes,
|
||||
currentCalendarType.keyElementName() + Bundle.DATEFORMATITEM_KEY_PREFIX + skeleton);
|
||||
} else {
|
||||
pushIgnoredContainer(qName);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user