-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Improve array loading times for large snapshots #48910
Comments
Some more assets are available at http://shortn/_09Yx1TBIBc (google only, sorry) |
Here is the breakdown of where arrays are coming from in terms of snapshot sizes. This was computed from heapsnapshot generated by
Some of this is fairly trivial to prune:
|
This is caused by a bug which adds a lot of duplicated entries to these caches. I am going to fix this: |
This field is only used only by vm-service (including hot reload and debugging), Kernel loading and mirrors. So drop it to prevent putting it into the AOT snapshot. Saves at 125Kb of snapshot size on large Flutter app. Related to #48910 TEST=ci Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try Change-Id: Id7c47496e87482d462c2b318307f617d48758ad1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242864 Commit-Queue: Slava Egorov <[email protected]> Reviewed-by: Alexander Markov <[email protected]>
No code actually relies on it being there. This saves ~1kb of snapshot size on a large Flutter application. Related to #48910 TEST=ci Change-Id: I03cf8811f39fc8882f7c650a79f01d350b520e5d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242863 Commit-Queue: Slava Egorov <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
We do allow different isolate groups in the same AOT VM in general, so while adding a flag may work for normal flutter, it's maybe not ideal. Since different isolate groups are based on different source code, the set of constants all IGs understand are limited to corelib-only-using constants. Maybe it would be better to simply prune the constants: Exclude any constant based on user-defined class/function and any constant transitively referencing such? We can measure and see what % we could remove. |
Ah, good point. I thought we match classes by name (like we used to do when sending static functions), but in reality we I have run some quick check on the heap snapshot and I think that would drop ~60% of constants. Would be nice to do that. Another option I have considered is that we could recollect constants using full heap scan if we drop all caches - the situation of two or more isolate groups is very unlikely in a Flutter application so it seems strange to pay for this. |
TEST=--print_array_optimization_candidates Bug: #48910 Change-Id: I6e5031ce9cca4128b8fb75dd5c9e43ad57e7013c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243527 Reviewed-by: Dan Field <[email protected]> Reviewed-by: Siva Annamalai <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
Here is the data for the GPay AOT snapshot from using the flag
|
With 706e62a - [vm] Canonicalize empty Class::interfaces_ INFO: From Flutter, aot, snapshotting //java/com/google/nbu/paisa/flutter/gpay/app:android_release_android_library_flutter_artifacts_android_aot: |
Another related fix https://dart-review.googlesource.com/c/sdk/+/243709 (Trim user-defined entries from classes constants table) |
https://dart-review.googlesource.com/c/sdk/+/242864 (Removes used_scripts field from AOT product builds) |
https://dart-review.googlesource.com/c/sdk/+/242862 (Avoids duplicate entries in invocation dispatcher cache) |
https://dart-review.googlesource.com/c/sdk/+/244303 is the CL in progress to remove dictionary entries (The CL still has some failing tests that need investigation). A preliminary run of building the AOT snapshot including this CL shows the following stats |
…runtime. flutter_gallery Isolate(CodeSize): 2116400 -> 1981238 (-6.28%) Total(CodeSize): 7217938 -> 7082600 (-1.87%) TEST=ci Bug: #48910 Change-Id: I8cd285ddab3a611cd7a2a91d50414be402f8543a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244303 Reviewed-by: Siva Annamalai <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
…eded at runtime." This reverts commit 6de162e. Reason for revert: Local testing of a large Flutter app with this change causes the app to crash on startup Original change's description: > [vm, compiler] Prune dictionaries to only contain elements needed at runtime. > > flutter_gallery > Isolate(CodeSize): 2116400 -> 1981238 (-6.28%) > Total(CodeSize): 7217938 -> 7082600 (-1.87%) > > TEST=ci > Bug: #48910 > Change-Id: I8cd285ddab3a611cd7a2a91d50414be402f8543a > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244303 > Reviewed-by: Siva Annamalai <[email protected]> > Commit-Queue: Ryan Macnak <[email protected]> # Not skipping CQ checks because original CL landed > 1 day ago. Bug: #48910 Change-Id: Ie51f004e84970907fa1233e8e7c3ed63e2da1c4c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246683 Reviewed-by: Siva Annamalai <[email protected]> Commit-Queue: Siva Annamalai <[email protected]> Reviewed-by: Ryan Macnak <[email protected]>
…eded at runtime." This is a reland of commit 6de162e Original change's description: > [vm, compiler] Prune dictionaries to only contain elements needed at runtime. > > flutter_gallery > Isolate(CodeSize): 2116400 -> 1981238 (-6.28%) > Total(CodeSize): 7217938 -> 7082600 (-1.87%) > > TEST=ci > Bug: #48910 > Change-Id: I8cd285ddab3a611cd7a2a91d50414be402f8543a > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244303 > Reviewed-by: Siva Annamalai <[email protected]> > Commit-Queue: Ryan Macnak <[email protected]> TEST=ci Bug: #48910 Change-Id: I3d3ecd04369585547963fb3efff1b3ff0723d8f8 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246990 Commit-Queue: Ryan Macnak <[email protected]> Reviewed-by: Siva Annamalai <[email protected]>
In a large snapshot for customer: money there's significant time spent on array deserialization in the snapshot. This area seems like it could be improved to either do less work or do its work a bit faster.
From discussion with @a-siva and @rmacnak-google:
The text was updated successfully, but these errors were encountered: