sroze / ngInfiniteScroll

Infinite Scrolling for AngularJS
http://sroze.github.com/ngInfiniteScroll/
MIT License
2.89k stars 723 forks source link

ngInfiniteScroll causes high CPU usage on Cordova Android app #368

Open gkimpson opened 7 years ago

gkimpson commented 7 years ago

I have a Cordova Angular application running on a Android 7.x device (onePlus 3 - so a relatively new device) and have a ng-repeat used inconjunction with ngInfiniteScroll to show a users 'news feed'.

Viewing the Android Monitor in Android Studio I can see the User CPU usage hovers around 20-30% even when the user is not actively doing anything in the app, when I remove the infinityScroll code this drops to 0-1% right away. The issue causes the app to hang after 2-3 minutes of usage (and becomes unusable & user most close the app to use it again), however without the infinity scroll code the app CPU usage is low and no longer hangs the app.

`<div infinite-scroll="tabs[tabIndex].FeedService.loadFeed(false, tabs[tabIndex].FeedService.filters, search.text, search.dateFrom, search.dateTo)" infinite-scroll-disabled="tabs[tabIndex].FeedService.busy || tabs[tabIndex].FeedService.noMoreResults || !tabs[tabIndex].active || tabs[tabIndex].FeedService.initialLoad" infinite-scroll-distance="1" infinite-scroll-immediate-check="false" >

-- rest of html code is not shown here--` Can anyone suggest how best to optimise ngInfiniteScroll so it uses less CPU usage - on desktop this is phone, but within a mobile webview (which is a lot less powerful) it seems to struggle a lot after a few minutes. Using the following: `Cordova 7.0.1` `Angular 1.3.0` `ngInfiniteScroll 1.2.2`