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

feat(perf): search perf #11096

Merged
merged 24 commits into from
Dec 3, 2024
Merged

feat(perf): search perf #11096

merged 24 commits into from
Dec 3, 2024

Conversation

brainbicycle
Copy link
Contributor

@brainbicycle brainbicycle commented Nov 14, 2024

This PR resolves PHIRE-1309

Description

Fairly minor change that replaces some lists in search with flashlist but does make nice improvements in list performance.

  • replaces autosuggest results with a FlashList from FlatList
  • useCallbacks in render functions
  • replace EntitySearchResults (other search tabs) with Flashlist
  • minor tweaks to props

Before

before-low.mov

After

after-low.mov

Follow-ups

  • as you can see from video more to be done in this flow, frame rates drop when switching tabs, typing and probably loading large images in artwork search

PR Checklist

  • I have tested my changes on iOS and Android.
  • I hid my changes behind a feature flag, or they don't need one.
  • I have included screenshots or videos, or I have not changed the UI.
  • I have added tests, or my changes don't require any.
  • I added an app state migration, or my changes do not require one.
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added a changelog entry below, or my changes do not require one.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Cross-platform user-facing changes

  • search list performance improvements - brian

iOS user-facing changes

Android user-facing changes

Dev changes

Need help with something? Have a look at our docs, or get in touch with us.

@brainbicycle brainbicycle self-assigned this Nov 14, 2024
@brainbicycle brainbicycle marked this pull request as draft November 14, 2024 18:36
@@ -87,6 +91,7 @@ export const EntitySearchResults: React.FC<SearchResultsProps> = ({ query, selec
}
onScrollBeginDrag={handleOnScrollBeginDrag}
onEndReached={handleLoadMore}
onEndReachedThreshold={0.5}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated this because the default was pretty choppy, scroll a small amount and get hard stop and loading indicator, was not very scientific but this seems to be smoother and load ahead of time when scrolling at a reasonable rate.

@brainbicycle brainbicycle marked this pull request as ready for review December 2, 2024 18:46

const ESTIMATED_ITEM_SIZE = 60

export function AboveTheFoldFlashList<ItemType>(props: AboveTheFoldFlashListProps<ItemType>) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a new component rather than replacing everywhere because I tried and it broke a bunch of stuff, they are probably just style issues

@@ -188,9 +208,9 @@ const AutosuggestResultsFlatList: React.FC<{
}

return (
<Flex>
<Flex style={{ width: "100%", height: "100%" }}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the flashlist wouldn't render without this, maybe can be addressed in AboveTheFoldFlashList component to not break other surfaces if we migrate

@ArtsyOpenSource
Copy link
Contributor

ArtsyOpenSource commented Dec 2, 2024

This PR contains the following changes:

  • Cross-platform user-facing changes (search list performance improvements - brian - brainbicycle)

Generated by 🚫 dangerJS against 7f3a751

gkartalis
gkartalis previously approved these changes Dec 3, 2024
Copy link
Member

@gkartalis gkartalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

One thought: I think we might need to change the name of the newly added component AboveTheFoldFlashList since it is not exactly representative of what this component is doing

@brainbicycle
Copy link
Contributor Author

Looks great!

One thought: I think we might need to change the name of the newly added component AboveTheFoldFlashList since it is not exactly representative of what this component is doing

fair, I just copied the other AboveTheFoldFlatlist component and replace the Flatlist with Flashlist, but maybe something like InfiniteScrollFlashList 🤷

MounirDhahri
MounirDhahri previously approved these changes Dec 3, 2024
Copy link
Member

@MounirDhahri MounirDhahri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for improving this - @dblandin will be very happy

@brainbicycle brainbicycle dismissed stale reviews from MounirDhahri and gkartalis via 19351d2 December 3, 2024 18:56
@brainbicycle brainbicycle added the Squash On Green A label to indicate that Peril should squash-merge this PR when all statuses are green label Dec 3, 2024
@artsy-peril artsy-peril bot merged commit e9f7f4e into main Dec 3, 2024
7 checks passed
@artsy-peril artsy-peril bot deleted the brian/search-perf branch December 3, 2024 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Jira Synced Squash On Green A label to indicate that Peril should squash-merge this PR when all statuses are green
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants