-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Use GN instead of Ninja to generate compile commands and save ~1sec off of no-op builds. #25737
Use GN instead of Ninja to generate compile commands and save ~1sec off of no-op builds. #25737
Conversation
It used to be that GN could not generate compile commands on its own. Instead, we would use Ninja to do the same in a separate invocation after GN. This worked but the invocation took about a second to complete. Now that GN can generate the compile commands as it is generating the Ninja build rules, we ask it generate the compile commands directly. The commands seem identical and IDE integrations continue to work. One difference now is that the compile commands are now generated in the build directory instead of the out directory like earlier. I think this is easier to reason about but if others think we need the old behavior, I can add a symlink to the compile_commands.json. This knocks 0.9 to 1 seconds off of a no-op build compared to numbers in flutter/flutter#81074. ``` $ time ./flutter/tools/gn --unopt Generating GN files in: out/host_debug_unopt Generating Xcode projects took 244ms Generating compile_commands took 104ms Done. Made 739 targets from 228 files in 1781ms ./flutter/tools/gn --unopt 3.07s user 3.04s system 325% cpu 1.875 total ``` Related to flutter/flutter#81074
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, LGTM
Might have to figure out what to do with IDE settings for this, but it'll be better I think because the IDE won't suddenly be changing just because of what your last GN command was.
Yeah, we can make the IDE stuff opt-in. But the 244 ms it takes is well away from being the bottleneck for now. Besides, that is generated in the single GN invocation. |
This pull request is not suitable for automatic merging in its current state.
|
I've filed a flake report and re-run the test. |
… ~1sec off of no-op builds. (flutter/engine#25737)
…ff of no-op builds. (flutter#25737)
It used to be that GN could not generate compile commands on its own. Instead,
we would use Ninja to do the same in a separate invocation after GN. This worked
but the invocation took about a second to complete. Now that GN can generate the
compile commands as it is generating the Ninja build rules, we ask it generate
the compile commands directly. The commands seem identical and IDE integrations
continue to work.
One difference now is that the compile commands are now generated in the build
directory instead of the out directory like earlier. I think this is easier to
reason about but if others think we need the old behavior, I can add a symlink
to the compile_commands.json.
This knocks 0.9 to 1 seconds off of a no-op build compared to numbers in
flutter/flutter#81074.
Related to flutter/flutter#81074