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
allow IKG to be provided a startup state #31167
Comments
If ikg-build puts results into the same byte store, then ikg-run will read them and serve for initial start of the app. If there are no changes in between, we will able to find the results. If there were changes, ikg-run will recompile changed libraries and reuse the rest. I would like to learn what flutter-build does in general, and why we need to send the kernels it produced. Starting two IKG instances does not seem right. We would need to read all sources twice, process them, read results from the byte store, deserialize them, read platform kernel, pay for performing JIT twice, etc. Plus this problem with the initial state. |
Quoting the command line help:
First thing we do when user does
|
OK, I see. Why is it necessary to Why is it necessary to reuse these outside artifacts during
So, we build the initial
So, if IKG is created as a result of |
Since |
Why is it necessary to build I get the part about tracking dependencies, and the fact that we don't need to rebuild if we already have up to date results. We definitely don't want to lose this. But IKG also tracks dependencies for Dart files. If there are no changes, IKG will serve kernel results from the cache. If the kernel file is appended to whatever is the rest the of FLX file, it is not different than pre-building full FLX file. It actually might be more efficient, because we separate often changing kernel files from more stable VM, graphic resources, and whatever else is in FLX files (what is there BTW?). And the race condition in question can probably be solved easily - we need to extend |
My general understanding is that there might be constraints here from how android/gradle works. While it might be possible to change some of the details, I believe it is not an easy thing to do.
This sounds great! |
See https://dart-review.googlesource.com/#/c/sdk/+/15649
Is it the best for our users that we do some work twice? How often users have pre-build FLX file vs. make changes and run, so first build using one IKG and then run using the second IKG? If the second case is the most typical use case, we should avoid duplicating work and change the way how we build and run. |
R=ahe@google.com, paulberry@google.com, sigmund@google.com Bug: #31167 Change-Id: I48971fc86c440fec636a775fc68d4292b0309dfa Reviewed-on: https://dart-review.googlesource.com/15649 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Paul Berry <paulberry@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
OK, I added ability to set the initial state. But I think we still need to think about making the system overall most performant. |
Thanks Konstantin! |
We believe we need a mechanism to provide an initial state to IKG (as if it was restarted after an initial compile).
Context: flutter hot-reload might otherwise run into a data race condition.
@aam @a-siva - let me know if this correctly represents the scenario you described to me recently:
The potential data-race comes if an edit happens after ikg-build compiles and before ikg-run compiles. Then the hot-reload bits sent to the VM will be inconsistent.
I believe it is not possible to use the same process for both ikg-build and ikg-run. So one idea here is to able to start ikg-run with a known state.
@scheglov - what do you think?
The text was updated successfully, but these errors were encountered: