aboutsummaryrefslogtreecommitdiff
path: root/content/go1.7-binary-size.article
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2020-03-09 23:54:35 -0400
committerRuss Cox <rsc@golang.org>2020-03-17 20:58:37 +0000
commitaf5018f64e406aaa646dae066f28de57321ea5ce (patch)
tree8db7b1f049d83d215fa9abf68851efce7b5ccadb /content/go1.7-binary-size.article
parent86e424fac66fa90ddcb7e8d7febd4c2b07d7c59e (diff)
content: convert to Markdown-enabled present inputs
Converted blog to Markdown-enabled present (CL 222846) using present2md (CL 222847). For golang/go#33955. Change-Id: Ib39fa1ddd9a46f9c7a62a2ca7b96e117635553e8 Reviewed-on: https://go-review.googlesource.com/c/blog/+/222848 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
Diffstat (limited to 'content/go1.7-binary-size.article')
-rw-r--r--content/go1.7-binary-size.article19
1 files changed, 10 insertions, 9 deletions
diff --git a/content/go1.7-binary-size.article b/content/go1.7-binary-size.article
index 8b7c2fc..6c1dae1 100644
--- a/content/go1.7-binary-size.article
+++ b/content/go1.7-binary-size.article
@@ -1,10 +1,11 @@
-Smaller Go 1.7 binaries
+# Smaller Go 1.7 binaries
18 Aug 2016
+Summary: Go was designed for writing servers. That is how it is most widely used today, and as a result a lot of work on the runtime and compiler is focused on issues that matter to servers: latency, ease of deployment, precise garbage collection, fast startup time, performance.
David Crawshaw
crawshaw@golang.org
-* Introduction
+## Introduction
Go was designed for writing servers.
That is how it is most widely used today, and as a result a lot of
@@ -15,13 +16,13 @@ fast startup time, performance.
As Go gets used for a wider variety of programs, there are new issues that must be considered.
One of these is binary size.
It has been on the radar for a long time
-(issue [[https://golang.org/issue/6853][#6853]] was filed over two
+(issue [\#6853](https://golang.org/issue/6853) was filed over two
years ago), but the growing interest in using Go for
deploying binaries on smaller devices — such as the Raspberry Pi or
mobile devices — means it received some attention for the Go 1.7
release.
-* Work done in Go 1.7
+## Work done in Go 1.7
Three significant changes in Go 1.7 affect binary size.
@@ -41,7 +42,7 @@ Now the compiler discards any unexported methods that do not match an
interface.
Similarly the linker can discard other exported methods, those that are only
accessible through reflection, if the corresponding
-[[https://golang.org/pkg/reflect/#Value.Call][reflection features]]
+[reflection features](https://golang.org/pkg/reflect/#Value.Call)
are not used anywhere in the program.
That change shrinks binaries by 5–20%.
@@ -61,9 +62,9 @@ interface data layout, better static data layout, and simplified
dependencies. For example, the HTTP client no longer links in the entire HTTP
server.
The full list of changes can be found in issue
-[[https://golang.org/issue/6853][#6853]].
+[\#6853](https://golang.org/issue/6853).
-* Results
+## Results
Typical programs, ranging from tiny toys to large production programs,
are about 30% smaller when built with Go 1.7.
@@ -99,7 +100,7 @@ of program shipped to phones.
Big downloads make for a poor user experience, so the reduction here
is good news.
-* Future Work
+## Future Work
Several changes to the run-time type information were too late for the
Go 1.7 freeze, but will hopefully make it into 1.8, further shrinking
@@ -108,7 +109,7 @@ programs, especially position-independent ones.
These changes are all conservative, reducing binary size without increasing
build time, startup time, overall execution time, or memory usage.
We could take more radical steps to reduce binary size: the
-[[http://upx.sourceforge.net/][upx]] tool for compressing executables
+[upx](http://upx.sourceforge.net/) tool for compressing executables
shrinks binaries by another 50% at the cost of increased startup time
and potentially increased memory use.
For extremely small systems (the kind that might live on a keychain)