<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Go on mcclain.sh</title><link>http://mcclain.sh/tags/go/</link><description>Recent content in Go on mcclain.sh</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Thu, 15 Sep 2022 00:00:00 +0000</lastBuildDate><atom:link href="http://mcclain.sh/tags/go/index.xml" rel="self" type="application/rss+xml"/><item><title>Benchmarking in Go</title><link>http://mcclain.sh/posts/go-benchmarking/</link><pubDate>Thu, 15 Sep 2022 00:00:00 +0000</pubDate><guid>http://mcclain.sh/posts/go-benchmarking/</guid><description>&lt;p&gt;As a hobbyist Gopher, I still discover things about the language that surprise me. While working on a side project, I found myself trying to decide between two implementations where speed was a major factor. As it would turn out, Go actually has some great benchmarking tools! What better way to answer my question than to put them head-to-head?&lt;/p&gt;
&lt;p&gt;In this blog, We&amp;rsquo;ll work through a couple examples to learn exactly how to write these benchmarks, as well as how we dive deeper into the results. Overall speed is great, but what’s even better is getting to put things under a microscope and fine-tune them. Let’s start with how to write a benchmark with a simple example.&lt;/p&gt;</description></item><item><title>The Secret of the Twitch Chat API</title><link>http://mcclain.sh/posts/twitch-chat-api/</link><pubDate>Wed, 08 Jun 2022 00:00:00 +0000</pubDate><guid>http://mcclain.sh/posts/twitch-chat-api/</guid><description>&lt;p&gt;Have you ever been in a Twitch chat of someone with thousands, tens of thousands, or even hundreds of thousands of chatters? The endless firehose of memes and emotes seem to come so fast that it&amp;rsquo;s almost impossible to read. Have you ever wondered what technology backs Twitch chat to support the volume and throughput of millions of concurrent chatters?&lt;/p&gt;
&lt;p&gt;Spoilers: it&amp;rsquo;s &lt;a href="https://dev.twitch.tv/docs/irc" target="_blank" rel="noopener noreffer "&gt;IRC&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="irc-really"&gt;IRC? Really?&lt;/h2&gt;
&lt;p&gt;Yeah you know, IRC. Created in the late 80s and popularized in the 90s, I&amp;rsquo;d use it in the early 2000&amp;rsquo;s playing competitive Counter-Strike to post &lt;code&gt;5v5 | east | dust2 | cal-im | yours&lt;/code&gt; over and over to find people to practice against. Granted (but just as important), IRC is a &lt;em&gt;protocol&lt;/em&gt; rather than a specific implementation, which leaves a lot of room for building efficiency. While Twitch&amp;rsquo;s servers are based on &lt;a href="https://datatracker.ietf.org/doc/html/rfc1459.html" target="_blank" rel="noopener noreffer "&gt;RFC1459&lt;/a&gt;, they only support a &lt;a href="https://dev.twitch.tv/docs/irc#supported-irc-messages" target="_blank" rel="noopener noreffer "&gt;subset of IRC messages&lt;/a&gt;. In fact, to read and write chat message, we need just four commands:&lt;/p&gt;</description></item><item><title>Hacking on Cloud Foundry's Gorouter</title><link>http://mcclain.sh/posts/hacking-on-cloud-foundrys-gorouter/</link><pubDate>Mon, 12 May 2014 00:00:00 +0000</pubDate><guid>http://mcclain.sh/posts/hacking-on-cloud-foundrys-gorouter/</guid><description>&lt;p&gt;Late last week, a couple colleagues and myself discovered a small bug in Cloud Foundry&amp;rsquo;s &lt;a href="https://github.com/cloudfoundry/gorouter" target="_blank" rel="noopener noreffer "&gt;gorouter&lt;/a&gt; in which a websocket upgrade was not completed if a comma-separated list of values in the Connection header was provided. A &lt;a href="https://github.com/cloudfoundry/gorouter/pull/39" target="_blank" rel="noopener noreffer "&gt;pull request&lt;/a&gt; was pieced together, submitted and is currently being looked at by Pivotal. However, I figured, why let the learning stop there?&lt;/p&gt;
&lt;p&gt;There were several things that I was unfamiliar with:&lt;/p&gt;</description></item></channel></rss>