Skip to content

ICU-23371 Reduce the memory footprints of TransliteratorRegistry#3939

Open
gvictor wants to merge 1 commit intounicode-org:mainfrom
gvictor:ICU-23367
Open

ICU-23371 Reduce the memory footprints of TransliteratorRegistry#3939
gvictor wants to merge 1 commit intounicode-org:mainfrom
gvictor:ICU-23367

Conversation

@gvictor
Copy link
Copy Markdown
Collaborator

@gvictor gvictor commented Apr 13, 2026

  1. Intern CaseSensitiveString objects for source, target, variant in the registry
  2. Use a default capacity of 1 for variant list. The source-target key is mostly linked to 1 variant only.
  3. Use ConcurrentHashMap instead of Collections.synchronizedMap(new HashMap())
  4. Lazily initialize the script code cache in AnyTransliterator.

In total, it saves ~110 kB.

Checklist

  • Required: Issue filed: ICU-NNNNN
  • Required: The PR title must be prefixed with a JIRA Issue number. Example: "ICU-NNNNN Fix xyz"
  • Required: Each commit message must be prefixed with a JIRA Issue number. Example: "ICU-NNNNN Fix xyz"
  • Issue accepted (done by Technical Committee after discussion)
  • Tests included, if applicable
  • API docs and/or User Guide docs changed or added, if applicable
  • Approver: Feel free to merge on my behalf

@jira-pull-request-webhook
Copy link
Copy Markdown

Notice: the branch changed across the force-push!

  • icu4j/main/translit/src/main/java/com/ibm/icu/text/AnyTransliterator.java is different
  • icu4j/main/translit/src/main/java/com/ibm/icu/text/TransliteratorRegistry.java is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@jira-pull-request-webhook
Copy link
Copy Markdown

Notice: the branch changed across the force-push!

  • icu4j/main/translit/src/main/java/com/ibm/icu/text/AnyTransliterator.java is different
  • icu4j/main/translit/src/main/java/com/ibm/icu/text/TransliteratorRegistry.java is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@jira-pull-request-webhook
Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@gvictor gvictor changed the title ICU-23367 Reduce the memory footprints of TransliteratorRegistry ICU-23371 Reduce the memory footprints of TransliteratorRegistry Apr 14, 2026
1. Intern CaseSensitiveString objects for source, target, variant in the registry
2. Use a default capacity of 1 for variant list. The source-target key is usually linked to 1 variant only.
3. Use ConcurrentHashMap instead of Collections.synchronizedMap(new HashMap())
4. Lazily initialize the script code cache in AnyTransliterator.

In total, it saves ~110 kB.
@jira-pull-request-webhook
Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@gvictor gvictor requested review from markusicu and mihnita April 14, 2026 14:27
Copy link
Copy Markdown
Contributor

@mihnita mihnita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!
M

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.

2 participants