Closed hurali97 closed 1 month ago
📣 @seeronline! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
seeronline's link contains a malicious file. Don't download: https://www.virustotal.com/gui/file/b127de888f09ce23937c12b7fccfa47a8f48312b0e43eb59b6243f665c6d366a
📣 @flyinghead! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Current assignee @mountiny is eligible for the AutoAssignerNewDotQuality assigner, not assigning anyone new.
Triggered auto assignment to @strepanier03 (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
we can maybe move forward by mixing both options and removing the patch, once our PR is merged and available on NPM
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 date-fns-tz
library is here. Now, we can wait for two days and if there's no update from the reviewer, we will go ahead with creating the patch in Expensify.
sounds great 👍🏼
Could someone process payment for my review of https://github.com/Expensify/App/pull/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
![Screenshot 2024-08-26 at 12 41 31 PM](https://github.com/user-attachments/assets/023f56f3-ce11-4c83-88d9-93d07ffaf82d)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
![Screenshot 2024-08-26 at 12 42 15 PM](https://github.com/user-attachments/assets/83ce706f-1bcd-473b-bc33-b10fb1833772)To summarise;
formatjs
libraries to the latestdate-fns-tz
with the changes described above