commit | 2ce594e44637be0d5ad4d4f939911272fe4680aa | [log] [tgz] |
---|---|---|
author | Colin Cross <ccross@android.com> | Wed Jan 29 12:58:03 2020 -0800 |
committer | Colin Cross <ccross@android.com> | Wed Jan 29 16:23:40 2020 -0800 |
tree | 79c8831369b5ff38d6546d8f831fa77537efebd3 | |
parent | 38e095ae8a2a275909967ff8d771e59a71370505 [diff] |
Make ninjaString an interface There are 8935901 *ninjaString objects generated in an AOSP aosp_blueline-userdebug build, and 7865180 of those are a literal string with no ninja variables. Each of those *ninjaString objects takes a minimum of 48 bytes for 2 slices, plus 8 bytes for the pointer to the ninjaString. For the literal string case, one of those slices has a single element, (costing another 16 bytes for the backing array), and the other slice is empty, for a total of 72 bytes. Replace *ninjaString with a ninjaString interface. This increases the size of the reference from 8 bytes to 16 bytes, but using a type alias of a string for the literal string implementation uses only 16 bytes, saving 40 bytes per literal string or 314 MB. Test: ninja_strings_test Change-Id: Ic5fe16ed1f2a244fe6a8ccdf762919634d825cbe
Blueprint is a meta-build system that reads in Blueprints files that describe modules that need to be built, and produces a Ninja manifest describing the commands that need to be run and their dependencies. Where most build systems use built-in rules or a domain-specific language to describe the logic for converting module descriptions to build rules, Blueprint delegates this to per-project build logic written in Go. For large, heterogenous projects this allows the inherent complexity of the build logic to be maintained in a high-level language, while still allowing simple changes to individual modules by modifying easy to understand Blueprints files.