htmlangularautocompletemat-autocomplete

mat autocomplete is too slow while loading large data


I am using mat autocomplete https://material.angular.io/components/autocomplete/api in my angular project. while loading large data with 25k items. the performance gets low. it is too slow to search and suggest autocomplete. how to increase the performance of this?


Solution

  • I would recommend to load less data to your autocomplete . But if you really need to display/search this many items. The solution to your problem is virtual scroll.https://material.angular.io/cdk/scrolling/overview Because the filter function depending on the filter function you are using the most time is used by repainting it. Or a simpler solution but uses a bit more resource than virtual scroll . https://medium.com/better-programming/improving-angular-ngfor-performance-through-trackby-ae4cf943b878