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
perf: Improve collection-repeat image performance on iOS #3194
Comments
Just wanted to leave a link to something I looked at previously. It might be worth benchmarking against your web worker code to see how it compares. https://github.com/mallzee/cordova-collection-repeat-image-plugin |
I tried to create something like this in the past, the main idea was to create a directive to use in wherever I want to use with <img ng-src="my-awesome-pic.png" ion-utils-cache-base64> And store the base64 in a variable in a some factory or something like that. Just sharing my thoughts on this. |
Thanks all! I also tried the ng-src route. It just wasn't a convincing enough improvement for us to make it part of the framework yet. I'll look at everything you guys have linked. Thanks a lot. The Cordova plugin route is especially interesting... |
Any update on this? |
We've been at ng-conf and only just returned. I'll be looking into it this week. |
Working on this today. |
Any idea how you intend to do the conversion in the worker since worker |
We don't need the document object. I already know how to convert the worker to base64 (I'll have code up later today). The problem is caching the image before it hits the visible DOM. |
Hey - also anxiously awaiting this one, we've got an infinite list of images (like Facebook timeline) of unknown heights (until the images load). Currently we've got an ng-repeat being used but we are seeing some memory issues. So we have switched to the new collection-repeat, but as you note, there is a choppy stop-n-go type nature to the scrolling. Excited to see what you guys come up with. |
What if we use a plugin (like file-transfer) to literally download the image, and use it as a local image... I think it probably load faster than always reaching an external URL. |
There are performance gains to be had doing that, but they don't make a huge difference. When you start getting crazy with images, even applying a base64 string version of it still stalls the browser because it's painting on the main thread. Even more so if the image has to be scaled to fit the space. The main thing that's going to help this I believe it the native scrolling. Once that becomes standard there will be a lot more time on the main thread for stuff to happen. Then maybe offloading some preloading to service workers or something to keep things smooth. Another stop gap solution for offloading the scaling is to run an image proxy which is cached by something like cloudfront. We run a simple node server on heroku which will download an image, scale it to the size requested, and serve it with a cache TTL of a few days. That way the majority of the load is handled by the cache for the majority of our users. Then we just created a directive to augment the image tag to calculate the space that needed to be filled by the image and redirected to our image proxy. |
Take a look at https://github.com/chrisben/imgcache.js/tree/master/ |
Have you seen this web worker wrapped in an angular service? Looks promising. https://github.com/FredrikSandell/angular-workers |
softBarbarian http://goohoo.net/bitcoin-forex4you 18.03.2015, 01:50, "softBarbarian" notifications@github.com:Take a look at —Reply to this email directly or . |
Any update on this? |
Andrew got the web worker to process image data and feed it back to the main thread as base64 data working, but it didn't result in a significant performance boost. It was a great idea, one we'll probably leverage in different ways for Ionic v2, but it didn't help in this case. Feel free to take a look at Andrew's PR if you want to play around with it, but I don't think we'll be adding this to v1 of Ionic unless we come up with ideas of how to improve the performance further. |
I see many APP who hide the image when not in view and they reappear when you scroll. |
I am seeing the same issue. I try to display images in an ion-scroll and they don't show; I then move the scroll slightly and it shows up. When I pop the view and push into it again the images again don't show even though they were loaded up and showing earlier. Annoyed. |
take a look at what the team at angular material did to remedy this issue: |
Hi everyone, is this issue still in ionic version 1.1.0 ? Thanks |
This issue isn't limited to
Just having that background image set slows the app to a crawl (on iOS) whenever navigating to or from that template. I'm using The delay seems to increase with the number of cards in the DOM, but it's even perceptible with just 2-3 cards, so I can't work around the issue by limiting the number of elements in the DOM. Taking that EDIT: apparently EDIT 2: after a week of trying everything I could possibly imagine, the delay I was seeing was occurring because the elements in which the images are placed are absolutely positioned. No idea why, but that's what was causing the delay. Sorry. This message can be disregarded as it's no longer relevant to this thread. |
I created a directive like this :
And the performance issue is no longer here. Hope this help |
Do blob image do a difference rather than base64? |
I have noticed that it was solved for ionic 2. Is there any improvement for ionic 1? |
Up Up Anything here ? |
Interesting in any update |
My directive is working very fine on my mobile app, did you try it ? |
same as @tgensol but bit modified for my needs <img ng-src="{{imagePath}}" collection-image image="{{imagePath}}"> angular.module('starter').directive('collectionImage', function () {
return {
restrict: 'A',
link: function (scope, ele, attrs) {
attrs.$observe('image', function (val) {
ele.src = val;
});
}
};
}); |
None of the directives provide smooth performance as ionic 2 provide. |
Sure, but you cannot compare angularJS1 to angularjs 2 I guess |
Hi, I have notice there is a problem with scrolling in general especially on iPhone 5s wither it is Hybrid or Native App. You have to handle this on your own. Some remove image temporarily when it is not on the current view, others divide it into pages instead of scrolling 1 page. You can write an algorithm that handle massive numbers of elements, then sell it, I mean share it. Sent from my iPhone
|
Problems:
img src
gives a 50-200ms freeze on an iPhone 6.Solutions:
src
s, convert them to base 64, and give them back as a data-uri.The last solution needed is a way to cache the data uri into the webview beforehand. This will require some experimentation, but it's doable.
The text was updated successfully, but these errors were encountered: