A small sample of smaller binaries using go 1.7

agolangf · · 450 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>As I was preparing the next release of a <a href="https://github.com/moncho/dry">side project of mine</a> I thought it would be a good moment to measure and compare the size of the resulting binaries using 1.6.3 vs using 1.7rc5 (latest version available at that moment).</p> <p>The result has been a 24% decrease in binary sizes for x86-64 architectures, 15% for x86 architectures and 13% for arm. Details can be found in the table below.</p> <table><thead> <tr> <th>os-cpu</th> <th>1.6.3</th> <th>1.7rc5</th> <th>Binary size decrease</th> </tr> </thead><tbody> <tr> <td>dry-darwin-amd64</td> <td>9666128</td> <td>7321376</td> <td>24,26%</td> </tr> <tr> <td>dry-freebsd-amd64</td> <td>9670081</td> <td>7350169</td> <td>23,99%</td> </tr> <tr> <td>dry-linux-amd64</td> <td>9666625</td> <td>7333489</td> <td>24,14%</td> </tr> <tr> <td>dry-windows-amd64</td> <td>9664000</td> <td>7298048</td> <td>24,48%</td> </tr> <tr> <td>dry-darwin-386</td> <td>7629836</td> <td>6464384</td> <td>15,27%</td> </tr> <tr> <td>dry-freebsd-386</td> <td>7603305</td> <td>6457457</td> <td>15,07%</td> </tr> <tr> <td>dry-linux-386</td> <td>7652591</td> <td>6473134</td> <td>15,41%</td> </tr> <tr> <td>dry-windows-386</td> <td>7690752</td> <td>6481920</td> <td>15,72%</td> </tr> <tr> <td>dry-freebsd-arm</td> <td>7621922</td> <td>6647331</td> <td>12,79%</td> </tr> <tr> <td>dry-linux-arm</td> <td>7613761</td> <td>6617809</td> <td>13,08%</td> </tr> </tbody></table> <p>Sizes are in <strong>bytes</strong>. The build was done on <strong>Mac OS X</strong>.</p> <p>Good job, Go team!</p> <hr/>**评论:**<br/><br/>anxiousalpaca: <pre><p>at first i thought there was a size increase, because of the negative decrease in the table.</p></pre>monch0: <pre><p>Hmm I see. </p> <p>What will make it easier to understand? Removing the negative sign? maybe better wording in the column header?</p></pre>anxiousalpaca: <pre><p>either naming the column just &#34;Binary Size&#34; or omitting the negative sign will do. just fyi to avoid confusion, thanks for the results!</p></pre>monch0: <pre><p>done, thanks!</p></pre>waywardcoder: <pre><p>I saw similar size decreases on amd64, and one computation-heavy app I had was almost twice as fast. I think the SSA compiler definitely helped me there. </p></pre>karma_vacuum123: <pre><p>probably the metric i care about the least, but still, numbers are going in the right direction!</p></pre>andradei: <pre><p>So true. Still, compilation time, and GC time are also going down from what I heard.</p> <p>Would be nice to see some numbers in the same layout as this one, but they would be harder to get.</p></pre>b4ux1t3: <pre><p>Challenge accepted!</p> <p>NOTE: I have a spotty delivery record.</p></pre>Yojihito: <pre><p>RC6 is out, use that :).</p></pre>b4ux1t3: <pre><p>I feel like that&#39;s good advice just in general.</p> <p>I&#39;ve done a bunch of testing, and basically, while I&#39;m getting no consistent or reliable times, in general the builds from RC5 <em>and</em> RC6 are just faster. The problem is, I&#39;m getting weird, random short build times in 1.6.3 that usually don&#39;t beat RC5 or RC6 times, but do it often enough that it&#39;s annoying.</p> <p>I don&#39;t know what&#39;s wrong. All my builds are on identical VMs with no other activity. I&#39;m super confused as to where my test could be going wrong.</p></pre>lazy_jones: <pre><p>How does a comparison of stripped binaries look?</p> <p>By the way, this happens when I attempt to strip binaries compiled with a relatively recent Go version:</p> <pre><code>/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: symbols referenced by indirect symbol table entries that can&#39;t be stripped in: /Users/user/XXX _malloc ___error ... </code></pre></pre>Frakturfreund: <pre><p><code>strip -s</code> works under Linux with go1.7rc6, so it’s probably a macOS specific problem.</p></pre>gmallard: <pre><p>The change is impressive. I am getting better than is shown. Example:</p> <p>From: go1.6.3 -&gt; go1.7rc6</p> <p>485890(bytes) -&gt; 239628(bytes)</p> <p>For what it is worth:</p> <p>AMD Phenom(tm) II X6 1055T Processor Ubuntu 14.04.5 LTS</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

450 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传