Repository navigation
Avoid unnecessary expensive call to getTransactionDetails - #45529
Conversation
|
Shall I review this as C+? |
|
On this part: I'd argue because we're making an assumption here that is not backed by any numbers yet. Do you think you can provide some? Maybe we can ask Jason to record the very same workflow on an ad hoc build so we can benchmark few of these runs (as we don't yet have performance tests for this in place). At the same time I'd love to have someone try benchmark this with Reassure as even local measurements should be enough to help us decide here. Do you think that'd be helpful? |
|
FYI In the meantime I'm working on a fix & explanation for this underlying problem. If you know that calculating these in the first place doesn't make sense though, it's still valuable to pursue this update to the logic itself. |
Yeah it's a bit of an assumption, but I'm not sure that really matters. In the provided screenshot we can see that getTransactionDetails took 36% of the time, of which getFormattedCreated was most of it, so if we remove the call to it then we should see about a 36% speed up.
Yeah we could do that, but what problem does it solve? What are we trying to decide?
Yeah, that's what I'm thinking with this PR. Removing unnecessary computation seems like a no brainer and I don't think we need to measure it carefully right now. |
Thanks for offering, but I don't think we really need a C+ review / testing for this particular PR. |
Oh just wanted to get a basic confirmation before we roll this to everyone. |
grgia
left a comment
There was a problem hiding this comment.
Changes LGTM, minor comments
| return Localize.translateLocal(translationKey, { | ||
| formattedAmount, | ||
| comment: transactionDetails?.comment ?? '', | ||
| comment: TransactionUtils.getDescription(transaction) ?? '', |
There was a problem hiding this comment.
NAB, should this be called TransactionUtils.getComment?
There was a problem hiding this comment.
I guess description works for now since we are calling it like this in App
| const comment = (!TransactionUtils.isMerchantMissing(transaction) ? TransactionUtils.getMerchant(transaction) : TransactionUtils.getDescription(transaction)) ?? ''; | ||
| if (ReportActionsUtils.isTrackExpenseAction(reportAction)) { | ||
| return Localize.translateLocal('iou.threadTrackReportName', {formattedAmount, comment}); | ||
| } |
There was a problem hiding this comment.
should we also move this block up?
There was a problem hiding this comment.
can we? it relies on the formattedAmount and comment being defined 🤔
There was a problem hiding this comment.
Lets explore this later if its possible?
|
Awesome tweak, thanks @neil-marcellini! As @adhorodyski mentioned, we will target underlying issue in further perspective and this is a great starting point to mitigate negative impact entirely 🙇 Q: Apart from mentioned |
|
@neil-marcellini a little update from my end, nothing new though:
100% for merging this PR asap ✅ |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
mountiny
left a comment
There was a problem hiding this comment.
Moving this ahead given this should be a noticeable improvement in the App
| const comment = (!TransactionUtils.isMerchantMissing(transaction) ? TransactionUtils.getMerchant(transaction) : TransactionUtils.getDescription(transaction)) ?? ''; | ||
| if (ReportActionsUtils.isTrackExpenseAction(reportAction)) { | ||
| return Localize.translateLocal('iou.threadTrackReportName', {formattedAmount, comment}); | ||
| } |
There was a problem hiding this comment.
Lets explore this later if its possible?
| return Localize.translateLocal(translationKey, { | ||
| formattedAmount, | ||
| comment: transactionDetails?.comment ?? '', | ||
| comment: TransactionUtils.getDescription(transaction) ?? '', |
There was a problem hiding this comment.
I guess description works for now since we are calling it like this in App
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.10-2 🚀
|
|
🚀 Cherry-picked to staging by https://github.com/mountiny in version: 9.0.10-3 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.0.10-7 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.0.11-5 🚀
|

Details
From this profile trace we can see that 36% of the time for
getOrderedReportIDsis spent on getting these transaction details, specificallyTransactionUtils.getFormattedCreated. However, that field not used within thegetTransactionReportNamefunction so it's a complete waste. Now we'll only extract the specific transaction fields that are needed, when they are needed. It should speed up ordering the LHN by about 36%.Related Issues
#45528
PROPOSAL: N/A
Tests
N/A
Offline tests
N/A
QA Steps
No QA
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop