]> Cypherpunks repositories - gostls13.git/commit
cmd/link/internal/wasm: optimize data section in wasm binary
authorRichard Musiol <mail@richard-musiol.de>
Sun, 17 Mar 2019 14:51:30 +0000 (15:51 +0100)
committerRichard Musiol <neelance@gmail.com>
Thu, 21 Mar 2019 23:49:38 +0000 (23:49 +0000)
commit99e223289b023279fa27803184c3e3c8a3d523cc
tree803d30f14d239e074683adb9f172311c323daedc
parent4dad64f5f1530a02404d562c7e6992d285bd9087
cmd/link/internal/wasm: optimize data section in wasm binary

This change optimizes the data section in the wasm binary by
omitting blocks of zeroes and instead emitting data segments
with offsets skipping the zeroes.

This optimization is inspired by the memory-packing pass of the
wasm-opt tool and reduces the wasm binary size of "hello world" by 14%.

Change-Id: Iba3043df05bf6aab4745c5f8015c0337fc218aff
Reviewed-on: https://go-review.googlesource.com/c/go/+/167801
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/wasm/asm.go