-
Notifications
You must be signed in to change notification settings - Fork 476
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
Loading Flare actors in advance #110
Comments
Hi @stx, this is how we did it in the developer_quest app: Basically one file that defines the files you want to preload and exposes a method to do so. Then in your main you can call this directly before runApp:
|
@luigi-rosso Brilliant! Thanks so much! |
I found that you can speed up load times surprisingly significantly by caching the assets in parallel. I'm seeing a ~40% improvement with just a few files.
|
Oh great, thanks! I forgot to mention, you can also tell the cache to not prune:
Do that in main before runApp too. I wouldn't do this in projects that load an enormous amount of Flare files (or download a lot of them), but if you have small set, this helps keep them in cache. We've been working on some new features in the embedding branch (which unfortunately isn't compatible yet) which brings down the load even further times and reduces jank while loading as even the smaller operations are pushed to an isolate. We might merge some of those improvements into master if we end up being too far off from getting that whole branch merged. |
Awesome, thanks! That's good to know. What triggers pruning? |
It happens whenever a flare file is no longer referenced. FlareActor will reference count the Flare files it loads:
And then dereference them when they are no longer used (widget is detached or source is changed):
The cache gets pruned 2 seconds after the asset is no longer referenced:
|
Hi there,
I'm seeing an empty/blank space load delay when even tiny FlareActor files are loaded and I need them to be visible immediately upon a screen load. Is it possible to preload these assets prior to runApp() or using some other strategy?
Thanks for your great work on Flare!
The text was updated successfully, but these errors were encountered: