<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Midhun Devasia on Medium]]></title>
        <description><![CDATA[Stories by Midhun Devasia on Medium]]></description>
        <link>https://medium.com/@midhundevasia?source=rss-42e3c9a2a176------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*375KbK-XDUmIpPquVpKP6w.png</url>
            <title>Stories by Midhun Devasia on Medium</title>
            <link>https://medium.com/@midhundevasia?source=rss-42e3c9a2a176------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 17:23:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@midhundevasia/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Faster Way to Do Case-Insensitive String Comparison in Go]]></title>
            <link>https://medium.com/@midhundevasia/a-faster-way-to-do-case-insensitive-string-comparison-in-go-445f81d6d3d0?source=rss-42e3c9a2a176------2</link>
            <guid isPermaLink="false">https://medium.com/p/445f81d6d3d0</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Midhun Devasia]]></dc:creator>
            <pubDate>Tue, 02 Jun 2026 14:01:05 GMT</pubDate>
            <atom:updated>2026-06-02T14:01:05.082Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3GsjTTN-3ilKJj3OpeKLA.png" /></figure><p>While working on a protocol parser in Go, I ran into an interesting performance problem.</p><p>The parser needed to identify incoming commands in a case-insensitive way. That means all of the following inputs should resolve to the same command:</p><pre>DATA<br>data<br>DaTa<br>dAtA</pre><p>At first glance, this looks trivial.</p><p>However, there was an important constraint:</p><blockquote><em>I wanted to identify commands without allocations, without mutating the original bytes, and while preserving the exact payload received from the client.</em></blockquote><p>That requirement completely changed the implementation approach.</p><h3>The Obvious Solution</h3><p>The first thing most Go developers would reach for is:</p><pre>strings.ToLower(string(cmd))</pre><p>or</p><pre>bytes.ToLower(cmd)</pre><p>Then compare against known commands:</p><pre>switch strings.ToLower(string(cmd)) {<br>case &quot;data&quot;:<br>case &quot;mail&quot;:<br>}</pre><p>This works perfectly well.</p><p>But protocol parsers tend to sit on hot execution paths, and a few characteristics of these approaches become less desirable when processing large volumes of traffic.</p><h3>Problem #1: Allocations</h3><p>strings.ToLower() allocates a new string.</p><p>For most applications, that’s completely fine.</p><p>Protocol parsers are different. They process incoming data continuously across many connections, and even small allocations can accumulate over time, increasing:</p><ul><li>Garbage collection pressure</li><li>CPU usage</li><li>Memory churn</li><li>Latency under high concurrency</li></ul><p>I wanted command identification to remain allocation-free.</p><h3>Problem #2: Mutating Input</h3><p>Another option is:</p><pre>bytes.ToLower(cmd)</pre><p>However, this modifies the original byte slice.</p><p>That wasn’t acceptable for my use case because I wanted to preserve the raw payload exactly as received from the client.</p><p>Keeping the original bytes untouched is useful for:</p><ul><li>Debugging</li><li>Protocol tracing</li><li>Raw logging</li><li>Observability</li><li>Preserving wire-level payloads</li></ul><h3>Problem #3: Unicode Overhead</h3><p>Go’s string functions are Unicode-aware.</p><p>That’s absolutely the correct behavior for general-purpose text processing.</p><p>But my parser only deals with ASCII protocol commands.</p><p>Using full Unicode case folding for fixed ASCII command tokens introduces work that simply isn’t necessary.</p><h3>The ASCII Observation</h3><p>ASCII uppercase and lowercase letters differ by exactly one bit.</p><p>For example:</p><pre>&#39;A&#39; = 0x41 = 01000001<br>&#39;a&#39; = 0x61 = 01100001</pre><p>The difference is:</p><pre>0x20</pre><p>This means:</p><pre>c | 0x20</pre><p>converts an uppercase ASCII letter into its lowercase equivalent.</p><p>Examples:</p><pre>&#39;D&#39; | 0x20 =&gt; &#39;d&#39;<br>&#39;A&#39; | 0x20 =&gt; &#39;a&#39;<br>&#39;T&#39; | 0x20 =&gt; &#39;t&#39;</pre><p>This can be done without:</p><ul><li>Allocations</li><li>Unicode processing</li><li>Modifying the original bytes</li></ul><h3>Taking It One Step Further</h3><p>Instead of converting strings, I packed the first four command bytes into a uint32.</p><p>Then I normalized all four bytes simultaneously using a single bitmask operation.</p><p>The result is a compact, allocation-free lookup.</p><pre>var cmdLookup = map[uint32]byte{<br>    0x68656c6f: CmdHelo, // helo<br>    0x65686c6f: CmdEhlo, // ehlo<br>    0x6d61696c: CmdMail, // mail<br>    0x72637074: CmdRcpt, // rcpt<br>    0x64617461: CmdData, // data<br>...<br>...<br>}</pre><pre>func identifyCmd(cmd []byte) byte {<br>    if len(cmd) &lt; MinCmdLength {<br>        return 0<br>    }<br>    val := binary.BigEndian.Uint32(cmd[:MinCmdLength]) | 0x20202020<br>    if cmdType, ok := cmdLookup[val]; ok {<br>        return cmdType<br>    }<br>    if isStartTLSPrefix(cmd) {<br>        return CmdStartTLS<br>    }<br>    return 0<br>}</pre><h3>How It Works</h3><p>Suppose the client sends:</p><pre>DATA</pre><p>Raw bytes:</p><pre>44 41 54 41</pre><p>Packed into a uint32:</p><pre>0x44415441</pre><p>Apply the mask:</p><pre>| 0x20202020</pre><p>Result:</p><pre>0x64617461</pre><p>Which represents:</p><pre>&quot;data&quot;</pre><p>The same normalization works for:</p><pre>DATA<br>Data<br>DaTa<br>dAtA</pre><p>without:</p><ul><li>Allocations</li><li>Mutations</li><li>Loops</li><li>Repeated per-byte comparisons</li></ul><h3>Why 0x20202020 Works</h3><p>The value:</p><pre>0x20202020</pre><p>is simply four copies of 0x20.</p><pre>0x20 0x20 0x20 0x20</pre><p>When OR’d against the packed command, each ASCII character is normalized independently.</p><p>In effect, four characters are normalized with a single integer operation.</p><p>It’s a small trick, but an elegant one.</p><h3>Why Use binary.BigEndian.Uint32?</h3><p>This converts:</p><pre>[]byte{&#39;D&#39;, &#39;A&#39;, &#39;T&#39;, &#39;A&#39;}</pre><p>into a single integer that can be compared directly.</p><p>That avoids:</p><ul><li>Per-byte comparisons</li><li>Loops</li><li>Branch-heavy matching logic</li></ul><p>The parser effectively performs:</p><ol><li>One integer load</li><li>One bitmask operation</li><li>One map lookup</li></ol><p>All of which are extremely cheap.</p><h3>Important Limitations</h3><p>This optimization is intentionally specialized.</p><p>It works because the parser deals with:</p><ul><li>ASCII-only tokens</li><li>Fixed-width command structures</li><li>Predictable protocol input</li></ul><p>It would not be appropriate for arbitrary Unicode text processing.</p><p>And that’s perfectly fine.</p><p>Not every optimization needs to be generic.</p><h3>What I Found Most Interesting</h3><p>The most interesting part wasn’t the bitmask itself.</p><p>It was the realization that parsing performance often comes down to understanding the lower layers of the system:</p><ul><li>Binary representations</li><li>ASCII encoding</li><li>Allocation behavior</li><li>Compiler optimizations</li><li>CPU-friendly memory access patterns</li></ul><p>Sometimes the fastest solution isn’t a more complicated algorithm.</p><p>It’s simply avoiding unnecessary work altogether.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=445f81d6d3d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[There’s a New Go Framework for MCP Servers Worth Knowing About]]></title>
            <link>https://medium.com/@midhundevasia/theres-a-new-go-framework-for-mcp-servers-worth-knowing-about-ff8fc5692311?source=rss-42e3c9a2a176------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff8fc5692311</guid>
            <category><![CDATA[model-context-protocol]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Midhun Devasia]]></dc:creator>
            <pubDate>Tue, 26 May 2026 14:01:03 GMT</pubDate>
            <atom:updated>2026-05-26T14:01:03.403Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PY8bHiRNeChJ7eqLIa-kJg.png" /></figure><p>If you’re building with the Model Context Protocol, you might want to bookmark this.</p><p><a href="https://finemcp.dev/"><strong>FineMCP</strong></a> is a new open-source Go framework for building MCP servers — and unlike most libraries in this space, it comes production-ready out of the box. We’re talking security, observability, resilience, and multi-transport support, all included from day one.</p><p>It’s MIT licensed, actively maintained, and already has solid documentation and a community Slack.</p><p>If you’re working with AI tooling and Go is your language, this one’s worth a look: <a href="https://finemcp.dev/">finemcp.dev</a> — or go straight to the <a href="https://github.com/finemcp/finemcp">GitHub repo</a>.</p><p><em>Have you started building MCP servers? Drop a comment — would love to know what stack you’re using.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff8fc5692311" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I Switched Back to Light Mode After Years of Using Dark Theme Everywhere]]></title>
            <link>https://medium.com/@midhundevasia/why-i-switched-back-to-light-mode-after-years-of-using-dark-theme-everywhere-6ae24eee24e8?source=rss-42e3c9a2a176------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ae24eee24e8</guid>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[mental-health]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Midhun Devasia]]></dc:creator>
            <pubDate>Tue, 19 May 2026 15:24:22 GMT</pubDate>
            <atom:updated>2026-05-19T15:24:22.402Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bKtTkTq3NbkPQN-B8HknZw.png" /></figure><p>For years, dark mode felt like the perfect environment for programming.</p><p>Like many developers, I gradually moved everything into dark themes. My operating system, IDEs, terminals, browsers, dashboards, documentation tools — even most mobile apps.</p><p>At the time, it felt modern, calm, immersive, and easier on the eyes. Especially during long coding sessions late at night.</p><p>And honestly, I genuinely enjoyed it.</p><p>But somewhere along the way, something subtle changed.</p><p>Not dramatically.<br>Not all at once.</p><p>I simply began feeling less mentally alert during work, and for a long time I couldn’t understand why.</p><p>At first, I blamed fatigue.</p><p>Then long screen time.</p><p>Then burnout.</p><p>Eventually, I started wondering whether the environment I had been sitting inside for years was affecting more than just aesthetics.</p><h3>When Everything Started Blending Together</h3><p>As engineers, we constantly switch contexts throughout the day.</p><p>One moment we are writing code.</p><p>A few minutes later we are:</p><ul><li>reviewing logs,</li><li>investigating alerts,</li><li>replying to operational communication,</li><li>reading documentation,</li><li>scanning dashboards,</li><li>checking deployments,</li><li>or debugging production issues.</li></ul><p>My workflow constantly moves between:</p><ul><li>IDEs,</li><li>terminals,</li><li>monitoring dashboards like New Relic,</li><li>Kubernetes consoles,</li><li>emails,</li><li>internal communication platforms,</li><li>deployment pipelines,</li><li>and browser tabs filled with documentation.</li></ul><p>Dark mode initially made all of these tools feel visually consistent and comfortable.</p><p>Over time, though, that consistency started feeling different.</p><p>The boundaries between tasks became less mentally distinct.</p><p>Switching between:</p><pre>IDE → Monitoring Dashboard → Email → Communication Platform → Terminal</pre><p>began to feel like staying inside one uninterrupted environment instead of moving between different modes of thinking.</p><p>Coding, communication, investigation, and monitoring slowly started blending together.</p><p>My brain no longer strongly registered:</p><blockquote><em>“Now I’m debugging.”</em></blockquote><blockquote><em>“Now I’m responding operationally.”</em></blockquote><blockquote><em>“Now I’m investigating a system issue.”</em></blockquote><p>Everything existed inside the same dark, continuous workspace.</p><p>That was the first moment something about my workflow started feeling off.</p><h3>The Physical Signs I Initially Ignored</h3><p>Around the same time, I also began noticing smaller physical symptoms that were easy to dismiss:</p><ul><li>mild headaches,</li><li>drifting attention,</li><li>occasional eye fatigue,</li><li>difficulty sustaining focus during long reading sessions,</li><li>and mental tiredness during investigative work.</li></ul><p>One thing became especially noticeable after I paid closer attention to it:</p><p>I was slightly squinting while reading dense information on dark backgrounds.</p><p>Particularly in:</p><ul><li>dashboards,</li><li>logs,</li><li>emails,</li><li>monitoring tools,</li><li>documentation,</li><li>and smaller UI elements.</li></ul><p>It wasn’t severe enough to feel alarming.</p><p>Just persistent enough to quietly affect long work sessions.</p><p>Later, while reading more about display ergonomics and readability research, some of the findings sounded surprisingly familiar.</p><p>Several studies suggest that dark interfaces can, in certain situations:</p><ul><li>increase pupil dilation,</li><li>require more visual effort during prolonged scanning,</li><li>affect readability,</li><li>and increase cognitive load during extended reading tasks.</li></ul><p>Research also suggests that contrast sensitivity and focusing flexibility gradually change with age, which may make some dark-background reading conditions feel more tiring over time — especially during analytical or text-heavy work.</p><p>I’m not claiming dark mode is harmful.</p><p>And I know many people genuinely prefer it.</p><p>But for the first time, my experience started making practical sense to me.</p><h3>Switching Back to Light Mode</h3><p>A few months ago, mostly out of curiosity, I switched many of my daytime work tools back to light mode.</p><p>The effect was immediate enough that it surprised me.</p><p>The headaches gradually disappeared.</p><p>My attention felt steadier.</p><p>Long reading and investigation sessions became easier again.</p><p>But the biggest change was something harder to describe at first:</p><p>Different kinds of work started feeling mentally separate again.</p><p>Coding felt like coding.</p><p>Operational communication felt distinct from engineering work.</p><p>Monitoring dashboards once again felt investigative instead of blending into everything around them.</p><p>Emails stopped feeling like just another dark panel sitting beside my IDE.</p><p>The entire environment gained separation and texture again.</p><p>Oddly enough, the world itself even started feeling more colorful.</p><p>Not literally, of course — but perceptually.</p><p>The digital environment around me no longer felt flattened into one continuous experience.</p><h3>What I Changed Instead</h3><p>Interestingly, I didn’t move back to harsh bright screens at night.</p><p>Instead of forcing dark mode everywhere, I now mostly rely on:</p><ul><li>lighter interfaces during the day,</li><li>warmer color temperatures in the evening,</li><li>and Night Shift-style settings at night.</li></ul><p>That balance feels significantly better for me than using a single interface style universally across every environment and time of day.</p><p>And I think that was the bigger realization.</p><p>For years, I optimized heavily for comfort and consistency.</p><p>But somewhere along the way, too much environmental uniformity may have reduced the cognitive separation between the very different kinds of tasks I was performing all day.</p><h3>What the Research Seems to Suggest</h3><p>After reading more about readability, display polarity, and cognitive ergonomics, I realized my experience may not be unusual.</p><p>Several studies suggest that light backgrounds with dark text can improve:</p><ul><li>readability,</li><li>scanning speed,</li><li>comprehension,</li><li>and sustained attention,</li></ul><p>particularly in bright daytime environments.</p><p>Meanwhile, dark mode still has meaningful advantages:</p><ul><li>reduced glare,</li><li>lower perceived brightness,</li><li>and more comfortable viewing in low-light conditions.</li></ul><p>The more I read, the more it seemed that there is probably no universal “best” interface mode.</p><p>Lighting conditions, task type, age, work duration, and reading behavior all appear to influence how these environments affect us over time.</p><h3>Final Thoughts</h3><p>This post is not advice.</p><p>I’m not suggesting everyone should abandon dark mode.</p><p>I’m simply sharing an experience for people who may be feeling something similar but haven’t quite identified it yet.</p><p>For years, I optimized my environment for immersion and consistency.</p><p>But eventually I began wondering whether that same consistency was also reducing the mental separation between coding, communication, investigation, and operational work.</p><p>Switching back to lighter interfaces during the day unexpectedly restored some of that separation for me.</p><p>And surprisingly, that small environmental shift affected:</p><ul><li>my focus,</li><li>my attentiveness,</li><li>my headaches,</li><li>and even how distinctly different kinds of work felt throughout the day.</li></ul><p>Sometimes a change in brightness changes much more than we expect.</p><h3>References &amp; Related Reading</h3><h4>Ergonomics Studies on Display Polarity and Cognitive Load</h4><ul><li>Buchner, A., &amp; Baumgartner, N. (2007)<br> <em>Text–background polarity affects performance irrespective of ambient illumination and colour contrast</em><br> <a href="https://psycnet.apa.org/record/2007-06096-004">https://psycnet.apa.org/record/2007-06096-004</a></li><li>Piepenbrock, C., Mayr, S., &amp; Buchner, A. (2014)<br> <em>Smaller pupil size and better proofreading performance with positive than with negative polarity displays</em><br> <a href="https://link.springer.com/article/10.3758/s13414-014-0657-6">https://link.springer.com/article/10.3758/s13414-014-0657-6</a></li></ul><h4>Research on Dark Mode Readability and Prolonged Scanning</h4><ul><li>Dobres, J., Chahine, N., &amp; Reimer, B. (2017)<br> <em>Effects of ambient illumination, contrast polarity, and letter size on text legibility under glance-like reading</em><br> <a href="https://pubmed.ncbi.nlm.nih.gov/28245425/">https://pubmed.ncbi.nlm.nih.gov/28245425/</a></li><li>Nielsen Norman Group<br> <em>Dark Mode vs. Light Mode: Which Is Better?</em><br> <a href="https://www.nngroup.com/articles/dark-mode/">https://www.nngroup.com/articles/dark-mode/</a></li></ul><h4>Studies Discussing Pupil Dilation and Visual Effort in Dark Interfaces</h4><ul><li>Piepenbrock, C., Mayr, S., &amp; Buchner, A. (2014)<br> <em>Smaller pupil size and better proofreading performance with positive than with negative polarity displays</em><br> <a href="https://link.springer.com/article/10.3758/s13414-014-0657-6">https://link.springer.com/article/10.3758/s13414-014-0657-6</a></li><li>WIRED<br> <em>Dark Mode Isn’t Better for You, But We Love It Anyway</em><br> <a href="https://www.wired.com/story/dark-mode-chrome-android-ios-science/">https://www.wired.com/story/dark-mode-chrome-android-ios-science/</a></li></ul><h4>UX Research Comparing Readability Differences Between Light and Dark Themes</h4><ul><li>Nielsen Norman Group<br> <em>Dark Mode vs. Light Mode: Which Is Better?</em><br> <a href="https://www.nngroup.com/articles/dark-mode/">https://www.nngroup.com/articles/dark-mode/</a></li><li>Hall, R., Hanna, P., &amp; Huey, S. (2004)<br> <em>Effects of background/foreground color combinations on readability and aesthetic rating</em><br> <a href="https://www.researchgate.net/publication/220876993_Effects_of_BackgroundForeground_Color_Combinations_on_Readability_and_Aesthetic_Rating">https://www.researchgate.net/publication/220876993_Effects_of_BackgroundForeground_Color_Combinations_on_Readability_and_Aesthetic_Rating</a></li><li>Apple Human Interface Guidelines — Color &amp; Contrast<br> <a href="https://developer.apple.com/design/human-interface-guidelines/color">https://developer.apple.com/design/human-interface-guidelines/color</a></li><li>Android Developers — Dark Theme Best Practices<br> <a href="https://developer.android.com/develop/ui/views/theming/darktheme">https://developer.android.com/develop/ui/views/theming/darktheme</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ae24eee24e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>