<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>性能测试 on PlumePHP</title><link>https://plumephp.com/tags/%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95/</link><description>Recent content in 性能测试 on PlumePHP</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Fri, 13 Oct 2023 09:44:00 +0800</lastBuildDate><atom:link href="https://plumephp.com/tags/%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95/index.xml" rel="self" type="application/rss+xml"/><item><title>Go 基准测试和分配入门：用 -benchmem 看清楚优化是否值得</title><link>https://plumephp.com/go-benchmark-allocations-2023/</link><pubDate>Fri, 13 Oct 2023 09:44:00 +0800</pubDate><guid>https://plumephp.com/go-benchmark-allocations-2023/</guid><description>&lt;p&gt;刚开始写 Go 的时候，很多人会把“性能优化”理解成一种直觉游戏：我觉得这个写法少了一层函数调用，应该更快；我觉得这个循环里用了 &lt;code&gt;append&lt;/code&gt;，应该会慢；我觉得字符串拼接换成 &lt;code&gt;strings.Builder&lt;/code&gt;，一定更专业。直觉有时候能帮你发现问题，但它不能替代测量。尤其在 Go 里，编译器、逃逸分析、运行时分配器都在悄悄做事，很多看上去“聪明”的写法，实际效果可能很小，甚至更差。&lt;/p&gt;</description></item></channel></rss>