diff options
author | greatroar <61184462+greatroar@users.noreply.github.com> | 2020-05-07 11:47:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-07 11:47:23 +0200 |
commit | e2febf246ea42c8f4639151e34ebdbceacf7aa59 (patch) | |
tree | 95e25b10acebb2679a99a4aa35d8db07fd65142f /script | |
parent | 2cdeb1bf70e0a1d26910b86451b74ae386940786 (diff) | |
download | syncthing-e2febf246ea42c8f4639151e34ebdbceacf7aa59.tar.gz syncthing-e2febf246ea42c8f4639151e34ebdbceacf7aa59.zip |
all: Store assets as strings (#6611)
Storing assets as []byte requires every compiled-in asset to be copied
into writable memory at program startup. That currently takes up 1.6MB
per syncthing process. Strings stay in the RODATA section and should be
shared between processes running the same binary.
Diffstat (limited to 'script')
-rw-r--r-- | script/genassets.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/script/genassets.go b/script/genassets.go index 090d468fb..373c9c5fc 100644 --- a/script/genassets.go +++ b/script/genassets.go @@ -29,8 +29,8 @@ package auto const Generated int64 = {{.Generated}} -func Assets() map[string][]byte { - var assets = make(map[string][]byte, {{.Assets | len}}) +func Assets() map[string]string { + var assets = make(map[string]string, {{.Assets | len}}) {{range $asset := .Assets}} assets["{{$asset.Name}}"] = {{$asset.Data}}{{end}} return assets @@ -72,7 +72,7 @@ func walkerFor(basePath string) filepath.WalkFunc { name, _ = filepath.Rel(basePath, name) assets = append(assets, asset{ Name: filepath.ToSlash(name), - Data: fmt.Sprintf("[]byte(%q)", buf.String()), + Data: fmt.Sprintf("%q", buf.String()), }) } |