<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>performance on semikolan</title>
    <link>https://semikolan.me/tags/performance/</link>
    <description>Recent content in performance on semikolan</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Mon, 27 Jul 2026 21:19:11 +0530</lastBuildDate>
    <atom:link href="https://semikolan.me/tags/performance/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>When Big-O Lies</title>
      <link>https://semikolan.me/blog/when-big-o-lies/</link>
      <pubDate>Mon, 20 Jul 2026 00:00:00 +0000</pubDate>
      <guid>https://semikolan.me/blog/when-big-o-lies/</guid>
      <description>&lt;p&gt;There&amp;rsquo;s a particular kind of confidence that comes from writing &lt;code&gt;O(n log n)&lt;/code&gt; in a design doc. It feels like a proof. And it is one — about a limit you will, in practice, never reach.&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; The trouble starts when we treat the asymptote as advice for the machine in front of us.&lt;/p&gt;&#xA;&lt;p&gt;Last week I replaced a &amp;ldquo;slow&amp;rdquo; quadratic scan with a &amp;ldquo;fast&amp;rdquo; sort-then-sweep. The theory was unimpeachable. The result was &lt;em&gt;slower&lt;/em&gt; — for every realistic input we actually saw.&lt;/p&gt;</description>
    </item>
    <item>
      <title>The Quiet Cost of a Fast Loop</title>
      <link>https://semikolan.me/blog/quiet-cost-of-a-fast-loop/</link>
      <pubDate>Tue, 30 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://semikolan.me/blog/quiet-cost-of-a-fast-loop/</guid>
      <description>&lt;p&gt;The first time I saw a sorted array process faster than an identical unsorted one, I assumed I&amp;rsquo;d measured wrong. Same data, same instructions, same count. The only difference was order — and order, I&amp;rsquo;d been taught, doesn&amp;rsquo;t change complexity.&lt;/p&gt;&#xA;&lt;p&gt;It doesn&amp;rsquo;t. It changes the &lt;em&gt;constant&lt;/em&gt;, and the constant is a physical thing living in the branch predictor.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-branch-that-couldnt-guess&#34;&gt;The branch that couldn&amp;rsquo;t guess &lt;a class=&#34;anchor&#34; href=&#34;#the-branch-that-couldnt-guess&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;A modern CPU runs ahead of itself. When it hits an &lt;code&gt;if&lt;/code&gt;, it doesn&amp;rsquo;t wait to learn the answer — it bets, and speculatively executes the branch it thinks you&amp;rsquo;ll take. Guess right and the work is already done. Guess wrong and it throws away a dozen in-flight instructions and starts over.&lt;/p&gt;</description>
    </item>
    <item>
      <title>The Profiler Is Always Right</title>
      <link>https://semikolan.me/blog/the-profiler-is-always-right/</link>
      <pubDate>Fri, 03 Apr 2026 00:00:00 +0000</pubDate>
      <guid>https://semikolan.me/blog/the-profiler-is-always-right/</guid>
      <description>&lt;p&gt;I keep a mental list of times I was certain I knew where the time was going, ran a profiler to confirm it, and got humbled. The list is long. The profiler&amp;rsquo;s record against me is perfect.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-bottleneck-was-never-where-i-looked&#34;&gt;The bottleneck was never where I looked &lt;a class=&#34;anchor&#34; href=&#34;#the-bottleneck-was-never-where-i-looked&#34; aria-label=&#34;Link to this section&#34;&gt;#&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;I&amp;rsquo;d stare at the gnarly nested loop, the obvious &lt;code&gt;O(n²)&lt;/code&gt;, and optimize it for an afternoon. The profiler would then point, flatly, at a &lt;code&gt;json.Marshal&lt;/code&gt; call in the logging path that ran on every request. The scary algorithm ran twice a day. The boring serialization ran a million times an hour.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
