diff options
| author | Brad Fitzpatrick <bradfitz@tailscale.com> | 2025-09-09 07:36:55 -0700 |
|---|---|---|
| committer | Brad Fitzpatrick <brad@danga.com> | 2025-09-09 07:56:30 -0700 |
| commit | f1ded844540f66c1a426fa54700ee626a0f9e658 (patch) | |
| tree | 62b43f834852815d64dad2e97f314302f19e5f18 /control/controlknobs/controlknobs_test.go | |
| parent | f4ae81e015c32918e1198f0f2e2b0dd6332d4c99 (diff) | |
| download | tailscale-f1ded844540f66c1a426fa54700ee626a0f9e658.tar.xz tailscale-f1ded844540f66c1a426fa54700ee626a0f9e658.zip | |
cmd/tailscaled: add disabled debug file to force reflect for binary size experiments
This adds a file that's not compiled by default that exists just to
make it easier to do binary size checks, probing what a binary would
be like if it included reflect methods (as used by html/template, etc).
As an example, once tailscaled uses reflect.Type.MethodByName(non-const-string) anywhere,
the build jumps up by 14.5 MB:
$ GOOS=linux GOARCH=amd64 ./tool/go build -tags=ts_include_cli,ts_omit_webclient,ts_omit_systray,ts_omit_debugeventbus -o before ./cmd/tailscaled
$ GOOS=linux GOARCH=amd64 ./tool/go build -tags=ts_include_cli,ts_omit_webclient,ts_omit_systray,ts_omit_debugeventbus,ts_debug_forcereflect -o after ./cmd/tailscaled
$ ls -l before after
-rwxr-xr-x@ 1 bradfitz staff 41011861 Sep 9 07:28 before
-rwxr-xr-x@ 1 bradfitz staff 55610948 Sep 9 07:29 after
This is particularly pronounced with large deps like the AWS SDK. If you compare using ts_omit_aws:
-rwxr-xr-x@ 1 bradfitz staff 38284771 Sep 9 07:40 no-aws-no-reflect
-rwxr-xr-x@ 1 bradfitz staff 45546491 Sep 9 07:41 no-aws-with-reflect
That means adding AWS to a non-reflect binary adds 2.7 MB but adding
AWS to a reflect binary adds 10 MB.
Updates #17063
Updates #12614
Change-Id: I18e9b77c9cf33565ce5bba65ac5584fa9433f7fb
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Diffstat (limited to 'control/controlknobs/controlknobs_test.go')
0 files changed, 0 insertions, 0 deletions
