wallpaper_manager icon indicating copy to clipboard operation
wallpaper_manager copied to clipboard

Use isolates to perform decoding

Open aarol opened this issue 3 years ago • 5 comments

Currently the performance is not very good, because the image decoding is done on unefficiently here. The decoding happens on the main thread which hangs up the application. The solution to this is to run the decoding process in a separate isolate and sending the bytearray throught the method channel.

I have made a barebones example of this approach which uses very big images and the performance gain is noticeable, there are no frame drops on my emulator.

I'm hoping someone with more knowledge of the package could implement this.

aarol avatar Apr 30 '21 15:04 aarol

Yes, this implementation is necessary for very large images and does not block the application

edwinmacalopu avatar May 31 '21 16:05 edwinmacalopu

My application is lagging and frames are dropping constantly. How can I resolve this?

Pavel401 avatar Nov 11 '21 06:11 Pavel401

My application is lagging and frames are dropping constantly. How can I resolve this?

Are you using the code from the example? It should lag only for a small period probably due to memory being copied from the isolate.

aarol avatar Nov 11 '21 08:11 aarol

My application is lagging and frames are dropping constantly. How can I resolve this?

https://pub.dev/packages/wallpaper_manager_flutter use this package

Use this package, there will be no lag even for 4k images, thanks to @aarol for the idea.

PraveenGongada avatar Nov 11 '21 14:11 PraveenGongada

Thanks @Praveen-0603 this package solved all my problems.

Pavel401 avatar Nov 11 '21 14:11 Pavel401