Speedup getOrderedReportIDs by compering strings instead of Dates objects#28000
Conversation
|
@Beamanator Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@Szymon20000 @janicduplessis lint is failing |
|
@mountiny Fixed linting! |
|
I don't think this pr closes any existing issue. |
|
That would be great. Just to explain why we did those changes. Then we link it to the performance project. |
|
Added just one video as the change just optimises sorting and it has to work on all platforms if it works on one. |
Reviewer Checklist
Screenshots/Videos |
|
Added few comments, but good job! |
|
I don't see any comments. :D |
| if (isInDefaultMode) { | ||
| nonArchivedReports.sort( | ||
| (a, b) => new Date(b.lastVisibleActionCreated) - new Date(a.lastVisibleActionCreated) || a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase()), | ||
| (a, b) => compareStringDates(a.lastVisibleActionCreated, b.lastVisibleActionCreated) || a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase()), |
There was a problem hiding this comment.
here we had new Date(b.lastVisibleActionCreated) - new Date(a.lastVisibleActionCreated)
Please change to: compareStringDates(b.lastVisibleActionCreated, a.lastVisibleActionCreated)
There was a problem hiding this comment.
That would reverse the order.
There was a problem hiding this comment.
Yes, thats the point how it was done before
There was a problem hiding this comment.
Then tests won't pass. I can change values in the comparator function but it doesn't make sense for me.
(a, b) => cmp(a, b) is cleaner then (a, b) => cmp(b, a)
There was a problem hiding this comment.
ah I see what you meant. Once we extract it outside of the function it will make sense
|
@Szymon20000 forgot to request changes... 😄 |
|
@Szymon20000 Lint is failing |
allroundexperts
left a comment
There was a problem hiding this comment.
Looks good other than the lint changes!
|
🎯 @allroundexperts, thanks for reviewing and testing this PR! 🎉 An E/App issue has been created to issue payment here: #28107. |
|
@Szymon20000 Lets fix the lint and |
mountiny
left a comment
There was a problem hiding this comment.
Thanks for resolving the lint issues, going to merge and deploy the app
|
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.74-0 🚀
|
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.74-3 🚀
|






Details
For some reason creating Date object is super slow on Hermes. So @janicduplessis came up with the idea to compare strings instead.

Result:
the method now runs under 1s instead of 14s (when starting heavy accounts provided by @danieldoglas)
Fixed Issues
$#28001
$
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)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
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android
Simulator.Screen.Recording.-.iPhone.15.-.2023-09-22.at.13.59.47.mp4