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

perf: cache UIFont construction based on FontDescriptor #9948

Merged
merged 1 commit into from
Jul 2, 2022

Conversation

rigor789
Copy link
Member

@rigor789 rigor789 commented Jul 2, 2022

PR Checklist

What is the current behavior?

a new UIFont is constructed whenever a view is instantiated (that displays text).

What is the new behavior?

a new UIFont is created only when necessary, otherwise a single UIFont instance is reused.

Fixes/Implements/Closes #[Issue Number].

Reduces unnecessary UIFont creation by reusing existing UIFonts matching the same font parameters.
@cla-bot cla-bot bot added the cla: yes label Jul 2, 2022
@rigor789 rigor789 changed the base branch from master to alpha July 2, 2022 14:21
@rigor789
Copy link
Member Author

rigor789 commented Jul 2, 2022

The cache key generation is based on this benchmark (run in v8 based browser like chrome to get accurate results):

Benchmark

@NathanWalker NathanWalker merged commit c2cbfa5 into alpha Jul 2, 2022
@NathanWalker NathanWalker deleted the perf/ui-font-cache branch July 2, 2022 15:28
NathanWalker pushed a commit that referenced this pull request Jul 9, 2022
Reduces unnecessary UIFont creation by reusing existing UIFonts matching the same font parameters.
NathanWalker pushed a commit that referenced this pull request Jul 9, 2022
Reduces unnecessary UIFont creation by reusing existing UIFonts matching the same font parameters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants