-
Notifications
You must be signed in to change notification settings - Fork 136
Http progress listener has serious performance issue on Android #267
Comments
Note: I'm not a maintainer but I did write the initial progress implementation. iOS implementation uses .default Currently the android implementation uses fixed buffer of 1024 bytes which will make roughly 100k calls for 100MB file to the progress listener - again, assuming the buffer gets filled everytime Is there any specific reason buffer size of 1024 bytes was chosen? I think typical size for the network packet will be power of two in the range of 512b -> 32kb. |
To dampen the issue I would advise you @fireonmac to make sure you are removing the listeners after you have created them and don't need anymore and/or early exit for the specific files - or simply just do not subscribe multiple times, it will double the number of callbacks. If you happen to use react or other library/framework which re-render children on component state change (where you might store the number of downloaded bytes), make sure the stored progress change doesn't actually do that! |
am on the same team with @fireonmac. and i can confirm that we make sure that only one listener is attached at all time and the component containing percentage get refreshed only once in a while with a throttle. Not so much difference it makes thou. |
Is your feature request related to a problem? Please describe.
Http.AddListener('progress', (e) => ...) has serious performance issue when downloading large file(about 50mb) on Android device. I used it to show the progress of file download, but it makes my app too slow.
Describe the solution you'd like
It would be great to behave just like it does on IOS
Describe alternatives you've considered
How about limit frequency of emitting progress event only on Android
Additional context
This problem already seemed to be discussed in #195, but it was closed and still remains unfixed.
The text was updated successfully, but these errors were encountered: