<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Strings on Ou David | Systems Engineer</title><link>https://vvivid.dev/tags/strings/</link><description>Recent content in Strings on Ou David | Systems Engineer</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sat, 13 Jun 2026 10:34:19 +0700</lastBuildDate><atom:link href="https://vvivid.dev/tags/strings/index.xml" rel="self" type="application/rss+xml"/><item><title>String Concatenation vs strings.Builder in Go</title><link>https://vvivid.dev/posts/go_string_concat_vs_string_builder/</link><pubDate>Sat, 13 Jun 2026 10:34:19 +0700</pubDate><guid>https://vvivid.dev/posts/go_string_concat_vs_string_builder/</guid><description>&lt;p&gt;I often leave the same comment when I see string concatenation inside a loop:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If you build a string in a loop, use &lt;code&gt;strings.Builder&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That comment sometimes gets pushback from the team: the two operations probably will not matter much. Today, I want to show a simple benchmark to demonstrate why &lt;code&gt;strings.Builder&lt;/code&gt; is superior to doing &lt;code&gt;+=&lt;/code&gt; inside a loop.&lt;/p&gt;
&lt;p&gt;The runnable code and raw benchmark output are available in the public repo: &lt;a href="https://gitlab.vvivid.dev/showcase/go-lang-case-study"&gt;gitlab.vvivid.dev/showcase/go-lang-case-study&lt;/a&gt;.&lt;/p&gt;</description></item></channel></rss>