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
[AssetBundle/Engine] Large bundle loading cause frames missing #94464
Comments
What's the example? |
😢 Sorry, updated in the top comment. |
Assets are loaded on the UI thread (executes all Dart code for the root isolate). So if assets size is large, I/O overhead can not be neglected. Seems we tried to move it to other threads. :) |
Ahh sure this will definitely be slow. Is this a real thing though? I agree an application can do this but it doesn't seem necessary - there are several other serious reasons to avoid this pattern. Another question is how much time is spent on copying the data rather than loading it from disk. |
This is the data from some random COVID sites, loading this costs hugely, and yes not only Flutter will be stuck at present.
Not sure if |
Maybe we should be happy that this process only makes one frame missing? 😕 |
If you include a file as an Asset on Android, I do not believe you can use the I'm not recommending you do that, and I'm not entirely convinced that the asset IO should be synchronous, but I'm also not really swayed by this example - having a 50mb asset in your APK just seems like a really bad idea, and trying to load it all at once is going to really hurt on low end phones whether it's sync or async - forget even trying to parse the JSON into a usable data structure. |
Hi @AlexV525, Thanks for filing the issue. Provided that loading large files will block the UI thread and will result in frame loss. I believe this is working as intended and it is safe to close the issue. Thank you. |
I think we can leav ethis open for further discussion. |
Forget about the bundle, what's the best choice when loading such huge data? As I mentioned above, in this case, the data is from some COVID site, which includes plenty of statistics info. If any COVID app wants to use it, they'll try to load and parse it. The data might not be loaded every time, then when we are involved with the cache mechanism, we'll back to the start, using a plugin maybe. |
That would be loaded from the network though right? After downloading I guess you could chunk it out somehow instead of parsing the whole thing at once. |
Indeed.
I'm not sure it'll work in most cases since it's a simple JSON? |
Network IO will always be sync. You could manually find offsets of sublists. Or you could preprocess the json in some server rather than on device |
Large bundle (51M JSON file) loading still causes a couple of frames missing.
Related issues/PRs
Details
The text was updated successfully, but these errors were encountered: