-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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-09-23] Performance Improvement: Update formatjs libraries and upstream/patch date-fns-tz #47988
Comments
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Current assignee @mountiny is eligible for the AutoAssignerNewDotQuality assigner, not assigning anyone new. |
Triggered auto assignment to @strepanier03 ( |
This is generally my preferred approach. Report the issue with a minimal reproduction, and create a PR to fix it upstream. If you don't receive any feedback, proceed with a patch and create an issue to eventually remove the patch once the upstream fix is merged. If you do get feedback and the maintainer doesn't want to merge your fix for some reason, re-evaluate and open up a conversation with the team. |
looks like some good finds @hurali97 👍🏼 |
PR for |
sounds great 👍🏼 |
Could someone process payment for my review of #48067, thanks! |
@Ollyws sorry, the automation failed here. $250 to @Ollyws for their review, no regression tests required for this task cc @strepanier03 |
Noting we do not want to close this but make it monthly so we can track of the upstream PR |
Requested in ND. |
Skipping the payment summary for this issue since all the assignees are employees or vendors. If this is incorrect, please manually add the payment summary SO. |
$250 approved for @Ollyws |
I think we can close now then |
Problem
While we were analysing the latest traces from Jason, we realised that there's substantial amount of time spent in
formatjs
anddate-fns-tz
. We also double-checked this with our heavy accounts (~15k reports) and we got the same results. Following is how things look like on baseline:snapshot from profile
Solution:
While analysing the traces, we curated a list of places that can be improved in
formatjs
anddate-fns-tz
. Two noticeable items areBestFitMatcher
fromformatjs
andgetDateTimeFormat
fromdate-fns-tz
. Now, since these are third party libraries, we can bump them to the latest versions and see if they are already fixing performance related issues. We compared the code forBestFitMatcher
from the currently installed versionformatjs/intl-locale@3.3.0
withformatjs/intl-locale@4.0.0
and there was a significant refactor of this file.So it only made sense to bump
formatjs
libraries to the latest to get the performance improvements out of the box. Fordate-fns-tz
there was no significant updates togetDateTimeFormat
function, so to apply the improvements we have two options:date-fns-tz
date-fns-tz
by creating a PR to it's repositoryHowever, we don't know how long it would take for option 2 as it depends on the reviewer of that repo. We can maybe move forward by mixing both options and removing the patch, once our PR is merged and available on NPM.
The improvement for
getDateTImeFormat
is pretty simple. We haveIntl.DateTimeFormat
being re-initialised every timegetDateTimeFormat
is invoked. SincetestDateFormatted
is a static variable, we can move it outside of the function.Below is how things look like after
formatjs
version bumps anddate-fns-tz
patch:snapshot from profile
To summarise;
formatjs
libraries to the latestdate-fns-tz
with the changes described aboveThe text was updated successfully, but these errors were encountered: