No description
Find a file
Colin Cross 95bec3331c Use strings instead of simpleNinjaStrings where possible
Storing every string without ninja variable references through
simpleNinjaString costs 24 bytes and a heap allocation.  16 bytes
is used for the ninjaString.str string, 8 bytes for the
ninjaString.variables *[]variableReference.  An additional 8 bytes
is used for the resulting pointer into the heap.

The vast majority of calls to simpleNinjaString originate in
blueprint.parseBuildParams, which converts all of the parameters
passed to ctx.Build into ninjaStrings.  All together this was
allocating 1.575 GB of *ninjaString objects.

Add a parseNinjaOrSimpleStrings function that converts input strings
into ninjaStrings if they have ninja variable references, but also
returns a slice of plain strings for input strings without any ninja
variable references.  That still results in 1.39 GB of allocations just
for the output string slice, so also add an optimization that reuses
the input string slice as the output slice if all of the strings had
no variable references.

Plumb the resulting strings through everywhere that the []*ninjaStrings
were used.

This reduces the total memory allocations inside
blueprint.parseBuildParams in my AOSP aosp_cf_x86_64_phone-userdebug
build from 3.337 GB to 1.786 GB.

Test: ninja_strings_test.go
Change-Id: I51bc138a2a6b1cc7383c7df0a483ccb067ffa02b
2023-11-01 15:15:15 -07:00
.github/workflows Fix github builds for deprecated set-env and add-path commands (#333) 2020-11-23 16:52:58 -08:00
bootstrap Use strings instead of simpleNinjaStrings where possible 2023-11-01 15:15:15 -07:00
bpfmt bpfmt: Process all blueprint files when a directory is specified 2023-08-04 01:01:55 -07:00
bpmodify bpmodify: Add a set-bool flag to set single boolean values 2022-10-28 18:46:51 +00:00
deptools Make WriteDepFile escape spaces and special characters 2015-04-14 23:34:24 -04:00
gotestmain Support go1.18, drop support for <go1.8 2021-12-14 15:58:35 -08:00
gotestrunner gotestrunner: Make GOROOT absolute before chdir 2017-01-18 14:42:09 -08:00
loadplugins Implement plugins for bootstrap go modules 2015-09-14 15:35:12 -07:00
metrics Add unit test for EventHandler 2023-02-27 11:41:51 -05:00
microfactory apply gofmt 2023-02-21 15:11:20 -05:00
parser bpfmt: Test comment line while sorting arrays 2023-05-17 15:17:49 -07:00
pathtools Remove unnecessary locking in fs 2023-10-31 20:24:35 +00:00
proptools apply gofmt 2023-02-21 15:11:20 -05:00
tests Make test_tree_tests.sh slightly easier to read 2017-10-30 15:00:19 -07:00
.gitignore gitignore intelliJ files 2022-02-02 11:36:11 -05:00
.gofmt.sh Use github actions instead of travis 2020-06-15 10:32:10 -07:00
Android.bp Add name hint to blueprint. 2023-04-10 20:21:15 +00:00
CODEOWNERS Add CODEOWNERS: @google/blueprint 2020-10-07 11:57:54 +08:00
context.go Use strings instead of simpleNinjaStrings where possible 2023-11-01 15:15:15 -07:00
context_test.go Use strings instead of simpleNinjaStrings where possible 2023-11-01 15:15:15 -07:00
CONTRIBUTING.md Add CONTRIBUTING.md file 2015-03-16 00:12:49 -07:00
doc.go apply gofmt 2023-02-21 15:11:20 -05:00
glob.go Speed up globs with sharding 2021-04-15 11:04:11 -07:00
glob_test.go Rename Blueprints to Android.bp . 2021-09-02 11:48:19 +02:00
go.mod Use strings instead of simpleNinjaStrings where possible 2023-11-01 15:15:15 -07:00
levenshtein.go Add name hint to blueprint. 2023-04-10 20:21:15 +00:00
levenshtein_test.go Add name hint to blueprint. 2023-04-10 20:21:15 +00:00
LICENSE Add license headers and LICENSE file 2015-01-23 14:23:27 -08:00
live_tracker.go Wrap singleton ninjaString Eval calls 2023-07-11 19:58:01 +00:00
mangle.go Add license headers and LICENSE file 2015-01-23 14:23:27 -08:00
module_ctx.go Plumb module tags through to ninja. 2023-06-22 17:15:33 +00:00
module_ctx_test.go context: Allow running some singletons in parallel. 2023-05-19 19:03:08 +00:00
name_interface.go Add name hint to blueprint. 2023-04-10 20:21:15 +00:00
ninja_defs.go Use strings instead of simpleNinjaStrings where possible 2023-11-01 15:15:15 -07:00
ninja_strings.go Use strings instead of simpleNinjaStrings where possible 2023-11-01 15:15:15 -07:00
ninja_strings_test.go Use strings instead of simpleNinjaStrings where possible 2023-11-01 15:15:15 -07:00
ninja_writer.go Use strings instead of simpleNinjaStrings where possible 2023-11-01 15:15:15 -07:00
ninja_writer_test.go Use strings instead of simpleNinjaStrings where possible 2023-11-01 15:15:15 -07:00
OWNERS Refactor OWNERS in platform/build/blueprint 2020-10-08 16:23:53 -07:00
package_ctx.go Optimize memory usage of ninjaString 2023-06-15 21:53:56 -07:00
PREUPLOAD.cfg Add preupload hooks to build/blueprint 2021-02-23 10:29:46 -08:00
provider.go Add Providers to Blueprint 2020-09-22 18:20:18 -07:00
provider_test.go Make skip-cloning blueprint option public 2023-06-13 01:25:06 +00:00
README.md Update README.md . 2022-10-10 07:06:22 +00:00
scope.go Optimize memory usage of ninjaString 2023-06-15 21:53:56 -07:00
singleton_ctx.go Wrap singleton ninjaString Eval calls 2023-07-11 19:58:01 +00:00
splice_modules_test.go Maintain ordering between variants and aliases 2020-09-09 18:29:15 -07:00
visit_test.go apply gofmt 2023-02-21 15:11:20 -05:00

Blueprint Build System

Blueprint is part of Soong.

For more information, see build/soong/README.md .