Increase the speed of incremental compilation #34616
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
Performance optimization
PR changes
Others
Describe
提速目前框架的增量编译,原因如下:
框架中有不少 自定义command 的写法,这种写法会导致增量编译时,自定义command 默认会re-run,降低了二次增量编译速度。
从实验中可以看到,当0改动 二次增量编译时,触发了 290个重新re-run(占总1200个target的约1/4)。
因此将这些 自定义command 写为OUTPUT的文件形式,在二次增量编译时,则会判定这些OUTPUT的文件已经存在,不会 re-run 自定义command。可以参考 https://lowlevelbits.org/bottom-up-cmake-introduction/ 的分析。
该PR只修复了部分增量编译问题,剩余未修复部分需要分析其他原因并优化。