Skip to content

fix(DateFormat): add cache#13421

Draft
GDamyanov wants to merge 3 commits intomainfrom
calendar-optimization
Draft

fix(DateFormat): add cache#13421
GDamyanov wants to merge 3 commits intomainfrom
calendar-optimization

Conversation

@GDamyanov
Copy link
Copy Markdown
Contributor

@GDamyanov GDamyanov commented Apr 21, 2026

This PR introduces a centralized caching mechanism for [DateFormat] instances to significantly reduce memory consumption and improve performance across date-related components (Calendar, DatePicker, TimePicker, etc.).

Problem:
Previously, each component (DayPicker, YearRangePicker, etc.) was creating its own instance-level for [DateFormat]` objects. This led to:

  • Excessive memory usage: Multiple components created duplicate [DateFormat] instances with identical configuration

  • Component-level duplication: Each DayPicker or Calendar instance was creating its own formatters, even when using the same locale and options

Solution:

  1. Centralizes all DateFormat instances in a single static Map
  2. Uses composite cache keys in format: "type:JSON.stringify(options):locale"
  3. Automatically reuses instances across all components with matching configuration
  4. Eliminates per-component caching code

Fixes: #13414

@ui5-webcomponents-bot
Copy link
Copy Markdown
Collaborator

ui5-webcomponents-bot commented Apr 21, 2026

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview April 21, 2026 11:56 Inactive
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview April 21, 2026 12:04 Inactive
@GDamyanov GDamyanov requested a review from nnaydenow April 21, 2026 12:28
@GDamyanov GDamyanov changed the title feat(DateFormat): add cache fix(DateFormat): add cache Apr 22, 2026
@GDamyanov GDamyanov self-assigned this Apr 22, 2026
@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview April 22, 2026 07:57 Inactive
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.

[ui5-calendar]: excessive DateFormat instance creation causes memory and performance issues

2 participants