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

[HOLD for payment 2024-04-05] [HOLD for payment 2024-03-26] [Performance] Use Intl API from Hermes where possible #38447

Closed
mountiny opened this issue Mar 16, 2024 · 11 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Weekly KSv2

Comments

@mountiny
Copy link
Contributor

Coming from Slack cc @hurali97 please comment so I can assign you

### Problem
We have Intl polyfills in the codebase to provide for the missing JS APIs. While that’s not a bad thing, we can take advantage of Hermes supported Intl APIs and avoid polyfilling them. If we don’t do it, we add ~500 ms to the App Startup time on android on a heavy account.

Solution

Hermes has a list of Intl supported APIs and we can take advantage of them. On native platforms, we can remove the Intl APIs that are supported by Hermes and only polyfill the ones that are currently not supported/ worked on by Hermes.
We can safely remove the following polyfills from localize/index.native.ts:

  • @formatjs/intl-getcanonicallocales/polyfill
  • @formatjs/intl-datetimeformat
  • @formatjs/intl-numberformat
  • @formatjs/intl-pluralrules/polyfill

Below is how things will look like after the removal:

import polyfillListFormat from './polyfillListFormat';
import type IntlPolyfill from './types';

/**
 * Polyfill the Intl API, always performed for native devices.
 */
const intlPolyfill: IntlPolyfill = () => {
    // Native devices require extra polyfills which are
    // not yet implemented in hermes.
    // see support: https://hermesengine.dev/docs/intl/

    require('@formatjs/intl-locale/polyfill');

    polyfillListFormat();
};

export default intlPolyfill; 

With this, we only polyfill the APIs that are not supported/ worked on by hermes. Doing so, we save ~500 ms in the App Startup. Before and After Hermes trace screenshots are attached in the PR description.
Here’s the PR with the implementation.

@mountiny mountiny added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 16, 2024
@mountiny mountiny self-assigned this Mar 16, 2024
Copy link

melvin-bot bot commented Mar 16, 2024

Triggered auto assignment to @abekkala (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

Copy link

melvin-bot bot commented Mar 18, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 Weekly KSv2 labels Mar 19, 2024
@melvin-bot melvin-bot bot changed the title [Performance] Use Intl API from Hermes where possible [HOLD for payment 2024-03-26] [Performance] Use Intl API from Hermes where possible Mar 19, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Mar 19, 2024
Copy link

melvin-bot bot commented Mar 19, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Mar 19, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.54-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-03-26. 🎊

Copy link

melvin-bot bot commented Mar 19, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@rlinoz] The PR that introduced the bug has been identified. Link to the PR:
  • [@rlinoz] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@rlinoz] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@rlinoz] Determine if we should create a regression test for this bug.
  • [@rlinoz] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@abekkala] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@abekkala
Copy link
Contributor

PAYMENT SUMMARY FOR MAR 26

  • Fix: @hurali97 - Callstack - no Upwork payment
  • PR Review: @rlinoz - Internal - no payment 😉

@rlinoz do you think this one needs a regression test? otherwise, I can close this one out on Mar 26 after the PR regression period ends.

@rlinoz
Copy link
Contributor

rlinoz commented Mar 20, 2024

This got reverted actually, so let's keep it open.

But I don't think it needs a regression test

@abekkala
Copy link
Contributor

abekkala commented Mar 22, 2024

PAYMENT SUMMARY FOR MAR 26

  • Fix: @hurali97 - Callstack - no Upwork payment
  • PR Review: @rlinoz - Internal - no payment 😉

No regression test needed - this can be closed on Mar 26 after waiting period has ended

@slafortune
Copy link
Contributor

Just taking the action here - @abekkala has it all summarized 👍

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Mar 29, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-03-26] [Performance] Use Intl API from Hermes where possible [HOLD for payment 2024-04-05] [HOLD for payment 2024-03-26] [Performance] Use Intl API from Hermes where possible Mar 29, 2024
Copy link

melvin-bot bot commented Mar 29, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.57-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-04-05. 🎊

Copy link

melvin-bot bot commented Mar 29, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@rlinoz] The PR that introduced the bug has been identified. Link to the PR:
  • [@rlinoz] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@rlinoz] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@rlinoz] Determine if we should create a regression test for this bug.
  • [@rlinoz] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@slafortune / @abekkala] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Weekly KSv2
Projects
Development

No branches or pull requests

4 participants