FFImageLoading icon indicating copy to clipboard operation
FFImageLoading copied to clipboard

Super slow to load image on IOS - Xamarin Forms - only the first time

Open olivier38070 opened this issue 4 years ago • 5 comments

🐛 Bug Report

I build a Xamarin forms application. I have a content view ( full screen ) which contains a grid with 5 column, 4 Rows, displaying 20 images : png, 64x64 pixel, color images. on android, the screen is displayed in less than 1 second : it is immediately displayed.

on IOS, the screen is displayed after about 20 seconds the first time. if I remove the screen from the UI, and add it again : the screen is displayed immediately.

Expected behavior

Image should be loaded and displayed immediately.

Configuration

Xamarin forms v4.5.0.617 Ipad 9.7 " 2019, IOS 13.4.1 FFimageLoading 2.4.11.982

here is the code used to display the images :

<ffimageloading:CachedImage Aspect="AspectFit" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" DownsampleToViewSize="true" Source = "poissons.png" > ffimageloading:CachedImage.GestureRecognizers <TapGestureRecognizer Tapped="SelectMeal_Clicked" NumberOfTapsRequired="1" /> </ffimageloading:CachedImage.GestureRecognizers> ffimageloading:CachedImage.Transformations <fftransformations:RoundedTransformation Radius="64" BorderSize="5" BorderHexColor="#606060" /> </ffimageloading:CachedImage.Transformations> </ffimageloading:CachedImage>

Platform: IOS

olivier38070 avatar Apr 20 '20 11:04 olivier38070

You may try to set fewer tasks.

var config = new FFImageLoading.Config.Configuration();
config.SchedulerMaxParallelTasks = 1;  // Depending on how many parallel tasks you need.
ImageService.Instance.Initialize(config);
CachedImageRenderer.Init();

yichen0831 avatar Jun 09 '20 04:06 yichen0831

This solutions works, but I don't understand why. A value of "1" seems arbitrary and non-intuitive. The Googles was unable to help me find documentation that explains this value.

This problem was introduced some time between version 2.4.3 and 2.4.9 (and is still in 2.4.11). I rolled back my packages to versions we had previously used.

App Startup: 2.4.11 - 14 seconds 2.4.9 - 14 seconds 2.4.3 - 2 seconds

2.4.11 setting MaxParallelTasks to "1" - 2 seconds

scottkdavis avatar Jun 26 '20 17:06 scottkdavis

Perfect, Iwill try that solution

Le ven. 26 juin 2020 à 19:51, Scott K Davis [email protected] a écrit :

This solutions works, but I don't understand why. A value of "1" seems arbitrary and non-intuitive. The Googles was unable to help me find documentation that explains this value.

This problem was introduced some time between version 2.4.3 and 2.4.9 (and is still in 2.4.11). I rolled back my packages to versions we had previously used.

App Startup: 2.4.11 - 14 seconds 2.4.9 - 14 seconds 2.4.3 - 2 seconds

2.4.11 setting MaxParallelTasks to "1" - 2 seconds

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/luberda-molinet/FFImageLoading/issues/1443#issuecomment-650313352, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB5HTRHC4VIZCI6HHILBBK3RYTNY7ANCNFSM4MMLMELA .

olivier38070 avatar Jun 27 '20 05:06 olivier38070

You may try to set fewer tasks.

var config = new FFImageLoading.Config.Configuration();
config.SchedulerMaxParallelTasks = 1;  // Depending on how many parallel tasks you need.
ImageService.Instance.Initialize(config);
CachedImageRenderer.Init();

This work for me, thx!

chaoyebugao avatar Sep 08 '20 08:09 chaoyebugao

Should I need to give the below code in Appdelegate.cs?

var config = new FFImageLoading.Config.Configuration(); config.SchedulerMaxParallelTasks = 1; // Depending on how many parallel tasks you need. ImageService.Instance.Initialize(config); CachedImageRenderer.Init();

emilon avatar Feb 19 '21 10:02 emilon