algolia / instantsearch

⚡️ Libraries for building performant and instant search and recommend experiences with Algolia. Compatible with JavaScript, TypeScript, React and Vue.
https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/
MIT License
3.59k stars 503 forks source link

Improve load-time performance of widgets #6008

Open Haroenv opened 5 months ago

Haroenv commented 5 months ago

When mounting a lot of widgets, the time to mount can add up quite a bit. This issue highlights a couple ways to deal with it. These PRs are ordered in the ordering they should end up in master.

Times are for an extreme app which mounts hundreds of widgets using DynamicWidgets.

The applied changed in 🟢 are available in InstantSearch.js 4.64.1, React InstantSearch 7.5.3, Vue InstantSearch 4.13.5

swap clearRefinements for individual refinement clearing methods which are more efficient 🟢

Fix sort of facet values in requestBuilder 🟢

avoid a copy of parameters to set in setQueryParameters and new SearchParameters 🟢

Don't recompute search parameters for every widget 🔴

Don't clean up "unused" UiState and parameters 🔴

redox commented 5 months ago

Exciting @Haroenv - I think https://sorare.com/football/market/new-signings could be a great production use-case to confirm those numbers ; I can give this a try next week

redox commented 5 months ago

@Haroenv I'm a bit confused, is instantsearch.js 4.64.1 including those?

dhayab commented 5 months ago

Hi @redox, Haroen is off so I'll answer in his place. Today's release of instantsearch.js@4.64.1, react-instantsearch@7.5.3 and vue-instantsearch@4.13.5 include the PRs mentioned in this issue.