-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Use AOT mode in the Dart SDK binaries #53576
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
Comments
CL to switch dds to run dds in AOT mode https://dart-review.googlesource.com/c/sdk/+/327140 |
CL to switch gen_kerenl to run in AOT mode when invoked from 'dart compile exe' command https://dart-review.googlesource.com/c/sdk/+/327520?tab=checks |
PR to add PR to modify |
PR to make |
On the topic of AOT compiling our tools:
The same but changing to run from AOT snapshot (which takes ~12s to produce):
|
Very nice! |
@a-siva looking at I'm wondering because discussion at #56454 makes it seem like the analysis server is still being invoked in Jit mode. |
I think it's still in JIT mode because we don't support running plugins from AOT; we always run them from source (JIT); please forgive any misunderstandings I have here 😅 . I did some prototyping with AOT-compiled plugins, for our plugins V2; so it's a thing we can do. |
Note also that the current approach to run macros in analyzer and DAS is to compile them into kernel files, and run in the same process. |
Yes, the analysis server has not yet been switched to AOT yet. Not sure why it had the checked flag above. Fixed it. |
We have had this discussion with the CFE team too and they have an out of process mode for executing the kernel files generated from macros. maybe the Analyzer should also consider this. |
Yes, it is still JIT mode, there was some discussion regarding plugins here https://docs.google.com/document/d/1W0JmNwlWD9W8Jf1vzC-W7MSOR-l1XOquVUCaf_7gs3A/edit?resourcekey=0-3fhJDVXmmWr4gLkBcRB9Sg&disco=AAAAwkyH-sY |
cc @bwilkerson @mit-mit this is related to our discussions regarding prioritizing efforts which would allow us to switch analyzer to AOT mode targeting next stable. |
@a-siva Is there any plan to also switch the formatter? Developers often have the format-on-save enabled, which will make the IDE/Editor format the source before writing to disc. Assume we have a dart file of length 1029:
Compare
with AOT compiled
=> that's 10x faster and 5x less memory. Since the |
I have seen this slowness too, and I agree that it's really noticeable and annoying. However, switching the formatter to AOT won't address it, because format-on-save doesn't use @scheglov is doing some work to try to make the analyzer handle dependencies in a more fine-grained fashion, which should improve this a lot by reducing how often the analyzer has to re-analyze large library cycles in the first place. |
My assumption was that the dart formatter is part of dartdev by importing it here import 'package:dart_style/src/cli/format_command.dart'; and when dartdev itself becomes an AOT module that would take care of it. |
Well, that depends on the editor and plugins used. At least my editor uses (Though interesting to know that the editor delegates this sometimes to LSP plugin - not something I would expect)
It's a choice. I'm not sure if people consciously thought about this. It seems
What determines which tool uses which mechanism? Is the plan to eventually have all tools in one big AOT snapshot or still a mixture of isolate spawning, subprocess spawning or direct invocation (which seems rather messy)? Depending on the timelines when |
This change adds a build target (see utils/analysis_server/BUILD.gn) called 'analysis_server_aot'. This new target is _not_ included in the Dart SDK (the create_sdk target). It's "opt-in" "for development." The name of the new output file matches that of other snapshots (see the dartdevc snapshots). Then we do special work in the plugin manager if "we are AOT." An analysis server running as AOT cannot spawn Isolates from a dart source files; we must first compile a dart source file to AOT as well, then we can spawn an Isolate to that AOT file. _Then_ when we run pub, we can no longer rely on using `Platform.executable`. `dartaotruntime pub get` is not a thing. We must instead find the `dart` tool on disk. To do that, we copy some complex discovery code from dartdev. Work towards #53402 Work towards #53576 Work towards #50498 Manually tested: * [+] analysis_server JIT snapshot works in IDE. * [+] analysis_server JIT snapshot works in IDE, with a legacy plugin (custom_lint). * [+] analysis_server JIT snapshot works at commandline. * [+] analysis_server AOT snapshot works in IDE. * [x] analysis_server AOT snapshot works in IDE, with a legacy plugin (custom_lint) - BROKEN. Need similar work that is done for new plugins. * [x] analysis_server AOT snapshot works at commandline - BROKEN. I think a fair bit of refactoring is required in dartdev lib/src/analysis_server.dart to use `VmInteropHandler.run` or similar. Change-Id: I53173c716fa2a763331ef524a96304f62165810e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417942 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Siva Annamalai <[email protected]>
Hmm, I don't think so. Maybe @a-siva can say what the concrete goal is. I see there are many binaries that we ship as both a JIT snapshot and as an AOT snapshot (like dart_tooling_daemon, and dartdevc). With 8d62a1f it is possible to build an AOT snapshot of DAS, via |
An update for the analysis server:
So this is more-or-less what is going out in the Dart 3.9 Beta 1. I should be able to land that Next, I'd like to flip the flag in Dart 3.9 Beta 2, so that the AOT snapshot is the default in each of those commands. But the JIT snapshot is still available and can be used via Later, we can remove the escape hatch, and the JIT snapshots. Maybe 3.9 final? Maybe 3.10? |
Use AOT mode in the Dart SDK binaries (faster startup and more predictable performance)
List of items to account for before this task is complete
The text was updated successfully, but these errors were encountered: