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

Improve iOS Text Mapper performance #570

Merged

Conversation

louiszawadzki
Copy link
Contributor

What does this PR do?

Improve performance of RN SR.

Motivation

The two calls that were taking the most CPU time were:

  • effectiveFont
    • it creates a new font object every time
    • font information is eventually dropped
  • UIColor.black.cgColor
    • this calls localized string on every call and makes it a long call
    • we can initialize the color only once

There's a huge drop in CPU ticks per seconds with this on a test view:

  • without the change: 299
  • without the RN integration (sending all wireframes): 171
  • this version (includes sending only wireframes within screen): 139
  • no SR: 129

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@louiszawadzki louiszawadzki requested a review from a team as a code owner December 18, 2023 13:31
Copy link
Member

@maxep maxep left a comment

Choose a reason for hiding this comment

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

👍

Comment on lines +82 to +83
// Black color. This is faster than accessing UIColor.black.cgColor.
let DEFAULT_COLOR = UIColor(white: 0, alpha: 1).cgColor
Copy link
Member

Choose a reason for hiding this comment

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

TIL :)

@louiszawadzki louiszawadzki merged commit 9555a3b into develop Dec 18, 2023
4 checks passed
@louiszawadzki louiszawadzki deleted the louiszawadzki/RUM-2173/improve-iOS-SR-performance branch December 18, 2023 15:52
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