-
- Downloads
You need to sign in or sign up before continuing.
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
Showing
- context.go 9 additions, 9 deletionscontext.go
- live_tracker.go 5 additions, 5 deletionslive_tracker.go
- ninja_defs.go 16 additions, 16 deletionsninja_defs.go
- ninja_strings.go 47 additions, 13 deletionsninja_strings.go
- ninja_strings_test.go 35 additions, 21 deletionsninja_strings_test.go
- package_ctx.go 3 additions, 3 deletionspackage_ctx.go
- scope.go 3 additions, 3 deletionsscope.go
Loading
Please register or sign in to comment