commit | f718a4249739f63e3a0c6e008faa3c7d47fa30f9 | [log] [tgz] |
---|---|---|
author | gregce <gregce@google.com> | Tue Jun 04 14:45:32 2019 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Tue Jun 04 14:46:47 2019 -0700 |
tree | e1adc41b1c84e62adf4b608e0b6bc676f9a17660 | |
parent | 7ac7723e09cf7e872f70c552217ca2e552ef5833 [diff] |
Fix performance regression with manual trimming. When --enforce_transitive_configs_for_config_feature_flag=true (which means manual trimming is enabled), the manual trimming transition applies to every configured target in the build, even though it's a no-op for most of them. But it unconditionally creates new BuildOptions instances, each of which has its hash key computed later in the build. This is expensive enough to severely harm analysis time. With this change, the transition returns the original instance when no trimming is necessary. Example results on a trivial android_binary depending on an android_library with trimming: Before: ############################################ # Original Blaze, manual trimming disabled: b/blazedev_orig build --nobuild //testapp:binary --enforce_transitive_configs_for_config_feature_flag=false | sort | uniq -c 137 CALLING BuildOptions.maybeInitializeFingerprintAndHashCode # Original Blaze, manual trimming enabled: b/blazedev_orig build --nobuild //testapp:binary --enforce_transitive_configs_for_config_feature_flag=true | sort | uniq -c 809 CALLING BuildOptions.maybeInitializeFingerprintAndHashCode 573 TRIMMING TRANSITION RETURNED NEW BUILDOPTIONS INSTANCE ############################################ After: ############################################ # Updated Blaze, manual trimming disabled: b/blazedev_new build --nobuild //testapp:binary --enforce_transitive_configs_for_config_feature_flag=false | sort | uniq -c 138 CALLING BuildOptions.maybeInitializeFingerprintAndHashCode # Updated Blaze, manual trimming enabled: b/blazedev_new build --nobuild //testapp:binary --enforce_transitive_configs_for_config_feature_flag=true | sort | uniq -c 475 CALLING BuildOptions.maybeInitializeFingerprintAndHashCode 209 TRIMMING TRANSITION RETURNED NEW BUILDOPTIONS INSTANCE ############################################ We still create more instances when manual trimming is on, but this is expected. Note that rules which don't use trimming (don't have the transitive_configs attribute) don't create *any* more instances. PiperOrigin-RevId: 251520074
{Fast, Correct} - Choose two
Build and test software of any size, quickly and reliably.
Speed up your builds and tests: Bazel only rebuilds what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.
One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.
Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.
Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.
Follow our tutorials:
See CONTRIBUTING.md
Bazel is released in ‘Beta’. See the product roadmap to learn about the path toward a stable 1.0 release.