{"id":10006894,"date":"2022-11-22T17:28:35","date_gmt":"2022-11-22T09:28:35","guid":{"rendered":"https:\/\/ityet.com\/?p=10006894"},"modified":"2022-11-22T17:28:35","modified_gmt":"2022-11-22T09:28:35","slug":"pgo-%e6%98%af%e5%95%a5%ef%bc%8c%e5%92%8b%e5%b0%b1%e8%ae%a9-go-%e6%9b%b4%e5%bf%ab%e6%9b%b4%e7%8c%9b%e4%ba%86%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10006894","title":{"rendered":"PGO \u662f\u5565\uff0c\u548b\u5c31\u8ba9 Go \u66f4\u5feb\u66f4\u731b\u4e86\uff1f"},"content":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u6211\u662f\u714e\u9c7c\u3002<\/p>\n<p>Go1.20 \u5373\u5c06\u53d1\u5e03\uff0c\u8fd1\u671f\u5f88\u591a\u5927\u4f6c\u63d0\u5230\u4e00\u4e2a\u5173\u952e\u8bcd <strong>PGO<\/strong>\uff0c\u8bf4\u662f\u6709\u5f88\u5927\u7684\u63d0\u9ad8\uff0c\u5f88\u731b&#8230;\u8ba9\u6211\u4e00\u6123\u4e00\u6123\uff0c\u4e0d\u7981\u601d\u8003\u662f\u4ec0\u4e48\uff1f<\/p>\n<p>\u4eca\u5929\u5c31\u7531\u714e\u9c7c\u548c\u5927\u5bb6\u4e00\u8d77\u5b66\u4e60\u3002<\/p>\n<h2>\u5feb\u901f\u4e86\u89e3<\/h2>\n<h3>PGO \u662f\u4ec0\u4e48<\/h3>\n<p>Profile-guided optimization (PGO)\uff0c\u7ffb\u8bd1\u8fc7\u6765\u662f\u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\u5f15\u5bfc\u7684\u4f18\u5316\u3002\u4e5f\u88ab\u79f0\u4e3a\uff1a<\/p>\n<ul>\n<li>profile-directed feedback\uff08PDF\uff09<\/li>\n<li>feedback-directed optimization\uff08FDO\uff09<\/li>\n<\/ul>\n<p>PGO \u662f\u8ba1\u7b97\u673a\u7f16\u7a0b\u4e2d\u7684<strong>\u4e00\u79cd\u7f16\u8bd1\u5668\u4f18\u5316\u6280\u672f<\/strong>\uff0c\u4f7f\u7528\u5206\u6790\u6765\u63d0\u9ad8\u7a0b\u5e8f\u8fd0\u884c\u65f6\u6027\u80fd\u3002\u4e5f\u5c31\u662f\u53ef\u4ee5\u63d0\u9ad8 Go \u8fd0\u884c\u65f6\u7684\u6027\u80fd\u3002<\/p>\n<p>\u8be5\u9879\u4f18\u5316\u662f\u4e00\u4e2a\u901a\u7528\u6280\u672f\uff0c\u4e0d\u5c40\u9650\u4e8e\u67d0\u4e00\u95e8\u8bed\u8a00\u3002\u50cf\u662f\uff1a<\/p>\n<ul>\n<li>\u5e38\u7528\u7684 Chrome \u6d4f\u89c8\u5668\uff0c\u5728 64 \u4f4d\u7248\u672c\u7684 Chrome \u4e2d\u4ece 53 \u7248\u5f00\u59cb\u542f\u7528 PGO\uff0c 32 \u4f4d\u7248\u5728 54 \u7248\u4e2d\u542f\u7528\u3002<\/li>\n<li>Microsoft Visual C++ \u4e5f\u540c\u6837\u6709\u6240\u4f7f\u7528\u3002<\/li>\n<li>AutoFDO \u8fdb\u884c\u4e86 PGO \u7684\u4f18\u5316\uff0c\u76f4\u63a5\u5c06\u67d0\u6570\u636e\u4e2d\u5fc3\u4e2d\u7684 C\/C++ \u7a0b\u5e8f\u7684\u6027\u80fd\u63d0\u9ad8\u4e86 5-15%\uff08\u4e0d\u7528\u6539\u4e1a\u52a1\u4ee3\u7801\uff09\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u4e2a\u4f18\u5316\u6210\u7ee9\uff0c\u4e00\u542c\u5c31\u5f88\u632f\u594b\u4eba\u5fc3\u3002<\/p>\n<h2>PGO \u600e\u4e48\u4f18\u5316<\/h2>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=C8GeD4XNvdZ5QVf%2FjdwQmw%3D%3D.vq2tvTe101ug7CnYAnJZBRTBd98ORXGQ0rgouN2iC7Oz8RA5yLj5%2BtGEV3q3HZeD7czjvasCtLPT4iDtnGOD2y5nIqyBInrzjHRXPrIX19qJmSTg8ryn0YlPlJ94DjlZDl7cyhA8NFlObiHvURJlRhkLsXapiutSjUS94%2FnrDDNPboyltbx%2B0KJ5BNT0RHxViv4EphczjBALvwqVKhfKxRqn%2BDRFhDKKufb8TyxS%2F2Y%3D\" rel=\"nofollow\" title=\"Intel Developer Guide and Reference\">\u300aIntel Developer Guide and Reference\u300b<\/a> \u4e2d\u5bf9 PGO \u7684\u4f18\u5316\u548c\u6d41\u7a0b\u6709\u4e00\u4e2a\u57fa\u672c\u4ecb\u7ecd\uff0c\u5982\u4e0b\u5185\u5bb9\uff0c\u5206\u4eab\u7ed9\u5927\u5bb6\u3002<\/p>\n<p>PGO \u901a\u8fc7\u7f29\u5c0f\u4ee3\u7801\u5927\u5c0f\u3001\u51cf\u5c11\u5206\u652f\u9519\u8bef\u9884\u6d4b\u548c\u91cd\u65b0\u7ec4\u7ec7\u4ee3\u7801\u5e03\u5c40\u4ee5\u51cf\u5c11\u6307\u4ee4\u7f13\u5b58\u95ee\u9898\u6765\u63d0\u9ad8\u5e94\u7528\u7a0b\u5e8f\u6027\u80fd\u3002\u5e76\u5411\u7f16\u8bd1\u5668\u63d0\u4f9b\u6709\u5173\u5e94\u7528\u7a0b\u5e8f\u4e2d\u6700\u5e38\u6267\u884c\u7684\u533a\u57df\u7684\u4fe1\u606f\u3002\u901a\u8fc7\u4e86\u89e3\u8fd9\u4e9b\u9886\u57df\uff0c\u7f16\u8bd1\u5668\u80fd\u591f\u5728\u4f18\u5316\u5e94\u7528\u7a0b\u5e8f\u65f6\u66f4\u5177\u9009\u62e9\u6027\u548c\u9488\u5bf9\u6027\u3002<\/p>\n<p>PGO \u7531\u4e09\u4e2a\u9636\u6bb5\u7ec4\u6210\u3002\u5982\u4e0b\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042860521\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<ul>\n<li><strong>\u68c0\u6d4b\u7a0b\u5e8f\u3002<\/strong>\u7f16\u8bd1\u5668\u4ece\u60a8\u7684\u6e90\u4ee3\u7801\u548c\u7f16\u8bd1\u5668\u7684\u7279\u6b8a\u4ee3\u7801\u521b\u5efa\u5e76\u94fe\u63a5\u4e00\u4e2a\u68c0\u6d4b\u7a0b\u5e8f\u3002<\/li>\n<li><strong>\u8fd0\u884c\u68c0\u6d4b\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/strong>\u6bcf\u6b21\u6267\u884c\u63d2\u6869\u4ee3\u7801\u65f6\uff0c\u63d2\u6869\u7a0b\u5e8f\u90fd\u4f1a\u751f\u6210\u4e00\u4e2a\u52a8\u6001\u4fe1\u606f\u6587\u4ef6\uff0c\u7528\u4e8e\u6700\u7ec8\u7f16\u8bd1\u3002<\/li>\n<li><strong>\u6700\u7ec8\u7f16\u8bd1\u3002<\/strong>\u5f53\u60a8\u7b2c\u4e8c\u6b21\u7f16\u8bd1\u65f6\uff0c\u52a8\u6001\u4fe1\u606f\u6587\u4ef6\u5c06\u5408\u5e76\u5230\u4e00\u4e2a\u6458\u8981\u6587\u4ef6\u4e2d\u3002\u4f7f\u7528\u6b64\u6587\u4ef6\u4e2d\u7684\u6982\u8981\u4fe1\u606f\u6458\u8981\uff0c\u7f16\u8bd1\u5668\u5c1d\u8bd5\u4f18\u5316\u7a0b\u5e8f\u4e2d\u6700\u9891\u7e41\u7684\u8fd0\u884c\u8def\u5f84\u53bb\u6267\u884c\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u5c31\u662f PGO \u8fd9\u9879\u4f18\u5316\u7684\u57fa\u672c\u8fc7\u7a0b\u4e86\u3002<\/p>\n<h2>\u65b0\u63d0\u6848<\/h2>\n<h3>\u80cc\u666f<\/h3>\n<p>\u63d0\u6848\u4f5c\u8005\uff08Cherry Mui\u3001Austin Clements\u3001Michael Pratt\uff09\u5efa\u8bae\u5411 Go GC \u5de5\u5177\u94fe\u589e\u52a0\u5bf9\u914d\u7f6e\u6587\u4ef6\u5f15\u5bfc\u4f18\u5316 (PGO) \u7684\u652f\u6301\uff0c\u53ef\u4ee5\u4f7f\u5f97<strong>\u5de5\u5177\u94fe\u80fd\u6839\u636e\u8fd0\u884c\u65f6\u4fe1\u606f\u6267\u884c\u7279\u5b9a\u4e8e\u5e94\u7528\u7a0b\u5e8f\u548c\u5de5\u4f5c\u8d1f\u8f7d\u7684\u4f18\u5316<\/strong>\u3002<\/p>\n<p>\u8bf4\u660e\u4e86\u5c31\u662f\u60f3\u63d0\u9ad8\u6027\u80fd\uff0c\u4e0d\u6539\u4e1a\u52a1\u4ee3\u7801\u3002<\/p>\n<h3>\u7528\u4ec0\u4e48\u6765\u505a<\/h3>\n<p>PGO \u9700\u8981\u7528\u6237\u53c2\u4e0e\u6765\u6536\u96c6\u914d\u7f6e\u6587\u4ef6\u5e76\u5c06\u5176\u53cd\u9988\u5230\u6784\u5efa\u8fc7\u7a0b\u4e2d\u624d\u80fd\u4f18\u5316\u3002\u8fd9\u662f\u4e00\u4e2a\u5927\u95ee\u9898\u3002<\/p>\n<p>\u6700\u7b26\u5408\u8fd9\u4e2a\u8981\u6c42\u7684\uff0c\u5c31\u662f pprof\u3002\u6700\u7ec8\u6572\u5b9a<strong>Go \u56e2\u961f\u5c06\u57fa\u4e8e <code>runtime\/pprof<\/code> \u6765\u5f97\u5230\u6240\u9700 profile<\/strong>\uff0c\u4ee5\u6b64\u6765\u5b8c\u6210 PGO\u3002\u56e0\u4e3a\u5b83\u7b26\u5408\uff1a\u91c7\u96c6\u6837\u672c\u5f00\u9500\u4f4e\u3001\u591a\u7cfb\u7edf\u517c\u5bb9\u6027\u5f3a\u3001Go \u6807\u51c6\u4e14\u88ab\u5e7f\u6cdb\u4f7f\u7528\u7684\u57fa\u51c6\u3002<\/p>\n<p>\u4e5f\u5c31\u662f\u6709 <code>runtime\/pprof<\/code> \u751f\u6210\u7684 profile\uff0c\u5c31\u80fd\u641e PGO \u4e86\uff01<\/p>\n<h3>\u652f\u6301\u5230\u4ec0\u4e48\u7a0b\u5ea6<\/h3>\n<p>PGO \u7b2c\u4e00\u4e2a\u7248\u672c\u5c06\u4f1a\u5148\u652f\u6301 pprof CPU\uff0c\u76f4\u63a5\u8bfb\u53d6 pprof CPU profile \u6587\u4ef6\u6765\u5b8c\u6210\u4f18\u5316\u3002<strong>\u9884\u8ba1\u5c06\u5728 Go1.20 \u53d1\u5e03\u9884\u89c8\u7248\u672c<\/strong>\u3002<\/p>\n<p>\u5728 Go \u5de5\u5177\u94fe\u4e0a\uff0c\u5c06\u5728 go build \u5b50\u547d\u4ee4\u589e\u52a0 <code>-pgo=&lt;path&gt;<\/code>\uff0c\u7528\u4e8e\u663e\u5f0f\u6307\u5b9a\u7528\u4e8e PGO \u6784\u5efa\u7684 profile \u6587\u4ef6\u4f4d\u7f6e\u3002<\/p>\n<p>\u53ef\u80fd\u4f1a\u6709\u540c\u5b66\u8bf4\uff0c\u8fd8\u5f97\u663e\u5f0f\u6307\u5b9a\uff0c\u592a\u9ebb\u70e6\u4e86\uff1f\u8fd9 Go \u56e2\u961f\u4e5f\u8003\u8651\u5230\u4e86&#8230;<\/p>\n<p>\u53ea\u9700\u8981\u4f60\u5c06\u5176<strong>\u8bbe\u7f6e\u4e3a\uff1a<code>-pgo=auto<\/code>\uff0c\u5c31\u4f1a\u81ea\u52a8\u53bb\u8bfb\u53d6\u4e3b\u76ee\u5f55\u4e0b\u7684 profile \u6587\u4ef6<\/strong>\uff0c\u975e\u5e38\u9999\uff01<\/p>\n<p>\u5982\u679c\u4e0d\u9700\u8981\uff0c\u90a3\u5c31\u76f4\u63a5 <code>-pgo=off<\/code> \u5c31\u80fd\u5b8c\u5168\u5173\u95ed PGO\u3002<\/p>\n<p>Go1.20 \u5b9e\u73b0 PGO \u7684\u9884\u89c8\u7248\u672c\uff0c\u914d\u7f6e\u9ed8\u8ba4\u4e3a off\uff0c\u6210\u719f\u540e\u4f1a\u9ed8\u8ba4\u4e3a auto\u3002<\/p>\n<h3>\u4ece\u54ea\u91cc\u5148\u52a8\u624b<\/h3>\n<p>Go \u56e2\u961f\u5148\u4f1a\u4e13\u6ce8\u4e8e Go \u7f16\u8bd1\u5668\u7684\u5f00\u53d1\uff0c\u6bd5\u7adf\u8fd9\u662f\u4e07\u7269\u7684\u5f00\u59cb\uff0c\u540e\u7eed\u4f1a\u5728 cmd\/go \u505a\u4e00\u4e9b\u7b80\u5355\u7684\u652f\u6301\u3002<strong>PGO \u7b2c\u4e00\u4e2a\u52a8\u624b\u7684\u65b9\u5411\u662f\uff1a\u51fd\u6570\u5185\u8054<\/strong>\u3002\u8fd9\u9879\u88ab\u8ba4\u4e3a\u6027\u4ef7\u6bd4\u662f\u6700\u9ad8\u7684\u3002<\/p>\n<p>\u672a\u6765\u5c55\u671b\u4e0a\uff0c\u8fd8\u4f1a\u5305\u542b\uff1adevirtualization\uff08\u53bb\u865a\u62df\u5316\uff0c\u4e00\u79cd\u7f16\u8bd1\u5668\u4f18\u5316\u7b56\u7565\uff09\u3001\u7279\u5b9a\u6cdb\u578b\u51fd\u6570\u7684\u6a21\u677f\u5316\u3001\u57fa\u672c\u5757\u6392\u5e8f\u548c\u51fd\u6570\u5e03\u5c40\u3002<\/p>\n<p>\u751a\u81f3\u540e\u7eed\u4f1a\u7528\u4e8e\u6539\u8fdb\u5185\u5b58\u884c\u4e3a\uff0c\u4f8b\u5982\uff1a\u6539\u8fdb\u9003\u9038\u884c\u4e3a\u548c\u5185\u5b58\u5206\u914d\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000042860522\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u770b\u770b\u8fd9\u4e2aPGO \u7684<a href=\"https:\/\/link.segmentfault.com\/?enc=JWVTzVQuzDVh%2BkrK2N%2Fu%2Bg%3D%3D.ccYfgKWyzIMv9KUFD9JoUFWXgUFpwlQ3LjHLQImAmPREMbO6hHV44XIH2us%2FS%2FaxX4qHv%2F3HFLfrCjTAy9GcqAafZQJn8VcFaQZ7vwWURSA%3D\" rel=\"nofollow\" title=\"\u672a\u6765\u5c55\u671b\">\u672a\u6765\u5c55\u671b<\/a>\uff0c\u8fd9\u4e2a\u997c\uff0c\u6211\u611f\u89c9\u753b\u7684\u53c8\u5927\u53c8\u5706\uff08\u8fdc\uff09&#8230;<\/p>\n<h2>\u8d85\u524d\u5b9e\u8df5<\/h2>\n<p>\u4ee5\u4e0b\u6765\u81ea @Frederic Branczyk \u5728\u300a<a href=\"https:\/\/link.segmentfault.com\/?enc=86hMPE4CNXGCNBQvco7jfA%3D%3D.0jo4obyqmi6%2BwF9bwWgg1dADE6FiLGQGD5Z85%2FGttbv3rqPPJ8M1SDviPUOSpFEdkz6Acw3si1a3IwQPH28atM4FrMla3i1fmk00oqYn9cbWhqMrVBCxyhra%2FgAALWlJ\" rel=\"nofollow\" title=\"Exploring Go's Profile-Guided Optimizations\">Exploring Go&#8217;s Profile-Guided Optimizations<\/a>\u300b\u4e00\u6587\u4e2d\uff0c\u63d0\u524d\u4f7f\u7528 PGO \u5bf9 Go \u5b98\u65b9\u5df2\u7ecf\u5f00\u53d1\u7684\u51fd\u6570\u5185\u8054\u8fdb\u884c\u4e86\u63d0\u524d\u5c1d\u9c9c\u3002<\/p>\n<p>\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<p>\u9996\u5148\u62c9\u53d6\u5df2\u5b9e\u73b0\u7684 Go \u6e90\u7801\u5e76\u8fdb\u884c\u7f16\u8bd1\u548c\u5bfc\u5165\u3002\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre><code class=\"go\">git clone https:\/\/go.googlesource.com\/go\ncd go\ngit fetch https:\/\/go.googlesource.com\/go refs\/changes\/63\/429863\/3 &amp;&amp; git checkout -b change-429863 FETCH_HEAD\ncd src\n.\/all.bash\ncd ..\nexport PATH=&quot;$(pwd)\/bin:$PATH&quot; # or add the path to your bashrc\/zshrc<\/code><\/pre>\n<p>\u8fdb\u5165\u5230 PGO \u7684\u5185\u8054\u6d4b\u8bd5\u4ee3\u7801\uff1a<\/p>\n<pre><code class=\"go\">cd src\/cmd\/compile\/internal\/test\/testdata\/pgo\/inline<\/code><\/pre>\n<p>\u505a\u63d0\u524d\u51c6\u5907\uff0c\u751f\u6210 pprof cpu profile \u6587\u4ef6\uff1a<\/p>\n<pre><code class=\"go\">go test -o inline_hot.test -bench=. -cpuprofile inline_hot.pprof<\/code><\/pre>\n<p>\u5b8c\u6210\u51c6\u5907\u52a8\u4f5c\u540e\u3002\u6211\u4eec\u8fdb\u884c\u4e24\u6b21\u6d4b\u8bd5\uff1a\u4e00\u6b21\u4e0d\u7528 PGO\uff0c\u4e00\u6b21\u7528 PGO\uff0c\u6765\u8fdb\u884c\u5bf9\u6bd4\u3002<\/p>\n<p>\u4e0d\u4f7f\u7528 PGO \u7684\u60c5\u51b5\uff1a<\/p>\n<pre><code class=\"go\">go test -run=none -tags='' -timeout=9m0s -gcflags=&quot;-m -m&quot; 2&gt;&amp;1 | grep &quot;can inline&quot;\n.\/inline_hot.go:15:6: can inline D with cost 7 as: func(uint) int { return int((i + (wSize - 1)) &gt;&gt; lWSize) }\n.\/inline_hot.go:19:6: can inline N with cost 20 as: func(uint) *BS { bs = &amp;BS{...}; return bs }\n...<\/code><\/pre>\n<p>\u4f7f\u7528 PGO \u7684\u60c5\u51b5\uff1a<\/p>\n<pre><code class=\"go\">go test -run=none -tags='' -timeout=9m0s -gcflags=&quot;-m -m -pgoprofile inline_hot.pprof&quot;<\/code><\/pre>\n<p>\u7528\u4e8e\u5982\u4e0b\u5bf9\u6bd4\uff1a<\/p>\n<pre><code class=\"go\">go test -o inline_hot.test -bench=. -cpuprofile inline_hot.pprof -count=100 &gt; without_pgo.txt\ngo test -o inline_hot.test -bench=. -gcflags=&quot;-pgoprofile inline_hot.pprof&quot; -count=100 &gt; with_pgo.txt\nbenchstat without_pgo.txt with_pgo.txt\nname  old time\/op  new time\/op  delta\nA-10   960\u00b5s \u00b1 2%   950\u00b5s \u00b1 1%  -1.05%  (p=0.000 n=98+83)<\/code><\/pre>\n<p>\u4ece\u7ed3\u8bba\u6765\u770b\uff0c\u5f15\u5165 PGO \u540e\u6709\u4e86 1% \u7684\u6027\u80fd\u6539\u8fdb\u3002\u5f53\u7136\uff0c\u8fd9\u53ea\u662f\u4e00\u5c0f\u6bb5\u6d4b\u8bd5\u4ee3\u7801\u3002\u4e0d\u540c\u7684\u7a0b\u5e8f\u7ed3\u679c\u4f1a\u4e0d\u4e00\u6837\u3002<\/p>\n<h2>\u603b\u7ed3<\/h2>\n<p>PGO \u662f\u4e00\u95e8\u7f16\u8bd1\u5668\u4f18\u5316\u6280\u672f\uff0c\u80fd\u591f\u5728\u4e0d\u6539\u4e1a\u52a1\u4ee3\u7801\u7684\u60c5\u51b5\u4e0b\uff0c\u7ed9\u4f60\u7684\u5e94\u7528\u7a0b\u5e8f\u5e26\u6765\u4e00\u5b9a\u7684\u6027\u80fd\u63d0\u5347\u3002\u5728 Go PGO \u4e2d\u5c06\u4f1a\u4f9d\u6258 runtime\/pprof \u6240\u751f\u6210\u7684 profile \u6765\u5b8c\u6210\uff08\u9700\u6539\u9020\uff09\uff0c\u4e5f\u7b97\u662f\u505a\u4e86\u4e00\u4e2a\u4e0d\u9519\u7684\u4e32\u8054\u3002<\/p>\n<p>\u53e6\u5916\u4ece\u9700\u6c42\u51fa\u53d1\u70b9\u6765\u770b\uff0c\u8fd9\u9879\u4f18\u5316\u611f\u89c9\u66f4\u591a\u7684\u6765\u81ea\u5f00\u53d1\u540c\u5b66\u7684\u5174\u8da3\u4f18\u5316\uff0c\u5b98\u65b9 issues \u4e2d\u5e76\u6ca1\u6709\u6307\u51fa\u662f\u7531\u4e8e\u4ec0\u4e48\u7528\u6237\u75db\u70b9\u5bfc\u81f4\u7684\u8981\u53bb\u5f00\u53d1\u8fd9\u9879\u529f\u80fd\u3002<\/p>\n<p>\u4e0d\u8fc7\u540e\u7eed\u5982\u679c\u9047\u5230\u4e00\u4e9b\u9700\u8981\u8fdb\u4e00\u6b65\u4f18\u5316\u7684 Go \u7a0b\u5e8f\uff0cPGO \u5c06\u4f1a\u662f\u4e00\u4e2a\u4e0d\u9519\u7684\u9009\u62e9\u3002\u6bd5\u7adf\u4e0d\u7528\u6539\u4e1a\u52a1\u4ee3\u7801\u3002<\/p>\n<blockquote><p>\u6587\u7ae0\u6301\u7eed\u66f4\u65b0\uff0c\u53ef\u4ee5\u5fae\u4fe1\u641c\u3010\u8111\u5b50\u8fdb\u714e\u9c7c\u4e86\u3011\u9605\u8bfb\uff0c\u672c\u6587 <strong>GitHub<\/strong> <a href=\"https:\/\/link.segmentfault.com\/?enc=STQC7l7FyHJYBgS6mQysOw%3D%3D.uznuuYQniWR6S93vLkjuOTIlgVKGXrqkIqDzXWgM49E%3D\" rel=\"nofollow\">github.com\/eddycjy\/blog<\/a> \u5df2\u6536\u5f55\uff0c\u5b66\u4e60 Go \u8bed\u8a00\u53ef\u4ee5\u770b <a href=\"https:\/\/link.segmentfault.com\/?enc=TwlpYQOybhOqn%2FEkgn2jBA%3D%3D.Z4gqG66WyOPTJpfoum2Z3AuH6tCxA%2B6fvzSMQbcInVNQshEXejZFMpMkCm9DfPnj\" rel=\"nofollow\">Go \u5b66\u4e60\u5730\u56fe\u548c\u8def\u7ebf<\/a>\uff0c\u6b22\u8fce Star \u50ac\u66f4\u3002<\/p><\/blockquote>\n<h3>Go \u56fe\u4e66\u7cfb\u5217<\/h3>\n<ul>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=wzAq8wrvxFAGJrrmeV3Mig%3D%3D.rYtMS%2FkYdddWqWAromnFPUcVIpq2A03EvbO%2FH00CkZY1lB6MVm4VZY4z3W7zUwVX\" rel=\"nofollow\">Go \u8bed\u8a00\u5165\u95e8\u7cfb\u5217\uff1a\u521d\u63a2 Go \u9879\u76ee\u5b9e\u6218<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=KZ9BWDjPNLzi7RcUY6cLyg%3D%3D.P8owTktCbvWVVSKqCE%2BoYSNn1tA%2B%2FQHbCgGV%2FgnPH5w%3D\" rel=\"nofollow\">Go \u8bed\u8a00\u7f16\u7a0b\u4e4b\u65c5\uff1a\u6df1\u5165\u7528 Go \u505a\u9879\u76ee<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=E%2BxCA0Cgj0ytSCxI3WbqgA%3D%3D.gzt3%2FnT51CUHFucouIGNoX%2FgRrW4CrE5kwfw0eGNF1U%3D\" rel=\"nofollow\">Go \u8bed\u8a00\u8bbe\u8ba1\u54f2\u5b66\uff1a\u4e86\u89e3 Go \u7684\u4e3a\u4ec0\u4e48\u548c\u8bbe\u8ba1\u601d\u8003<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=xi%2B3%2FJQtkO0dNmL5ZlwKvQ%3D%3D.HWTn9di0hqbDkX2g%2BNe4aW%2BgfDGlq5pt1N0aFnAwdMU%3D\" rel=\"nofollow\">Go \u8bed\u8a00\u8fdb\u9636\u4e4b\u65c5\uff1a\u8fdb\u4e00\u6b65\u6df1\u5165 Go \u6e90\u7801<\/a><\/li>\n<\/ul>\n<h4>\u63a8\u8350\u9605\u8bfb<\/h4>\n<ul>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=Av7OmdWOibSGKoOU%2BySxYw%3D%3D.K%2FcOZfYZTrNrCnG%2BczhSPMOyOP%2FKPrk%2B6gvCBPL%2B8LPpMzaRLr2fsJw2F1pGWfnTB5q6XpHeGZwF4XShbBIyBw%3D%3D\" rel=\"nofollow\">Go for \u5faa\u73af\u6709\u65f6\u5019\u771f\u7684\u5f88\u5751\u3002\u3002\u3002<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=hKptI87g5FR3muKlOa6g7g%3D%3D.logSytJA7cLP%2BPlkmCRwJwX6%2F3ttDbqYJNDXN03PF8I2w8B0UzdbdVXJzA6nNvnVYOyCle6s06GCZuGmfdSFOg%3D%3D\" rel=\"nofollow\">Go \u5341\u5e74\u4e86\uff0c\u7ec8\u4e8e\u60f3\u8d77\u8981\u7edf\u4e00 log \u5e93\u4e86\uff01<\/a><\/li>\n<li><a href=\"https:\/\/link.segmentfault.com\/?enc=PQt8cgH8EQxxdE9sEKORug%3D%3D.dT3PtPJAt36QTlyy%2BKMV8fd2vt8RSzvpkSPYuv3rnVsi8IiZsUFc09jsElHJDKb15I3AY3Vl%2Bz9VD1x8SLdM0Q%3D%3D\" rel=\"nofollow\">Go \u53ea\u4f1a if err != nil\uff1f\u8fd9\u662f\u4e0d\u5bf9\u7684\uff0c\u5206\u4eab\u8fd9\u4e9b\u4f18\u96c5\u7684\u5904\u7406\u59ff\u52bf\u7ed9\u4f60\uff01<\/a><\/li>\n<\/ul>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000042860519\">https:\/\/segmentfault.com\/a\/1190000042860519<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u6211\u662f\u714e\u9c7c\u3002 Go1.20 \u5373\u5c06\u53d1\u5e03\uff0c\u8fd1\u671f\u5f88\u591a\u5927\u4f6c\u63d0\u5230\u4e00\u4e2a\u5173\u952e\u8bcd PGO\uff0c\u8bf4\u662f\u6709\u5f88\u5927\u7684\u63d0\u9ad8\uff0c\u5f88\u731b&#038;#82 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10006894","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10006894"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006894\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10006894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10006894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10006894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}