Skip to content
This repository has been archived by the owner on Aug 3, 2020. It is now read-only.

getImage function slows down ui #23

Closed
BMXsanko opened this issue Apr 9, 2019 · 9 comments
Closed

getImage function slows down ui #23

BMXsanko opened this issue Apr 9, 2019 · 9 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed implementation issue Seems to be an issue due to implementation

Comments

@BMXsanko
Copy link
Contributor

BMXsanko commented Apr 9, 2019

The getImage function I added a few days ago is working fine, but it slows down the UI a lot, especially when you request a lot of images at once. I am not really sure whether the slowdown happens on the Dart side or on the Kotlin side... @Joran-Dob any idea why this might be?

@Joran-Dob
Copy link
Member

I will look into optimizing this functionality in the scope of release v0.1.0. Probably it's nice to move some of part of this implementation from Kotlin to Dart if possible. Might improve performance.

I will probably also add a warning to the readme that it can slow down the UI. when using this functionality.

@Joran-Dob Joran-Dob self-assigned this Apr 10, 2019
@Joran-Dob Joran-Dob added enhancement New feature or request help wanted Extra attention is needed implementation issue Seems to be an issue due to implementation labels Apr 10, 2019
@Joran-Dob Joran-Dob added this to the Release of v0.1.0 milestone Apr 10, 2019
@Joran-Dob
Copy link
Member

Added the warning to readme linked to this issue. ✈️

@BMXsanko
Copy link
Contributor Author

@Joran-Dob thanks! I will also look into some possible solutions.

@BMXsanko
Copy link
Contributor Author

BMXsanko commented Apr 10, 2019

OK, I discovered that the issue is on the Kotlin side of the code, the issue is that you can't just send the image "as is" because it is a Bitmap which is not supported by flutter, and the conversion takes a while.

@Joran-Dob
Copy link
Member

@BMXsanko awesome, I might have some time tomorrow to look into optimization of this conversion

@BMXsanko
Copy link
Contributor Author

@Joran-Dob I have looked into the issue I tried wrapping the getImage() method into the compute() function, which puts the function you assign it on a separate isolate, this, in theory, should have solved the issue but then I discovered this: flutter/flutter#13937

@BMXsanko
Copy link
Contributor Author

Ok, I made a PR regarding this issue, I didn't have time to fully test it, on the first look it seems to improve performance.

Joran-Dob added a commit that referenced this issue Apr 13, 2019
…formance-fix

Issue #23  get image function performance fix
@Joran-Dob
Copy link
Member

Merged the pull request. I will also merge some changes I made in a bit. And afterwards, close this issue! Thanks for your awesome work 😎

@mvarendorff
Copy link

Does that mean the warning may be removed from the readme as well?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed implementation issue Seems to be an issue due to implementation
Projects
None yet
Development

No branches or pull requests

3 participants