Reliable UDP & Zig: Part 2.5 - Branching

Investigating the branching improvements from Part 2 Modern CPUs use branch prediction to speculatively execute instructions, but when predictions fail, the performance penalty can be significant. Understanding and optimizing for branch behavior is crucial for high-performance networking code. This video serves as good background material for those unfamiliar with the topic. A short explanation, with my current understanding of the topic, is as follows: The overhead for a branch is generally small compared to the cost of a missed branch prediction. Most conditional statements based on random data (rather than simple arithmetic operations) will cause branches that are likely to be mispredicted This occurs because it’s much less likely that the next instruction will access the same memory location or adjacent memory Please reach out if you believe anything written here is incorrect. I’ve been actively learning and applying these concepts the last few months, so feedback is appreciated. ...

August 26, 2025 · 14 min

Reliable UDP & Zig: Part 2

Recap In part one, we implemented a minimal Reliable UDP in Zig. In this post, we extend the sender with a window size. This isn’t a full sliding window yet. For now, we buffer multiple packets and treat an ACK for a higher sequence number as acknowledging all preceding packets in the window. For example, if the last ACK was for sequence #4, our window size is 5, and we send #5–9, receiving an ACK for #7 means packets #5–7 are acknowledged. ...

August 3, 2025 · 15 min

Reliable UDP & Zig: Part 1

Reliable UDP Basics Back in university (2012–2015), my instructors taught us that UDP was so unreliable it was essentially unused in modern applications. Since TCP guarantees ordered packet delivery and provides useful features like bidirectional streaming and congestion control, the situation was presented as if the choice between TCP and UDP was settled—there was no reason to use UDP. In fact, it was implied that future development wouldn’t even require knowledge of TCP sockets, and possibly not even the details of HTTP. That was the prevailing stance at the time. ...

July 26, 2025 · 11 min

Guide to Japanese Input on Arch Linux

(Very Brief) Guide to Japanese Input on Arch Linux For anyone studying language with a character set other than English, being able to swap back and forth between input languages is important. This kind of functionality may come setup out of the box on Mac or Windows, but we need to do a little bit of work to get this functionality in Linux. IMF vs IME The TL;DR here is a classic client/server architecture, think of X11 vs a window manager. ...

July 1, 2025 · 3 min

2025 Arch Install

<insert "BTW I use arch" meme here> Installation The (Still) Manual Bits In the past Arch Linux was somewhat notorious for its installation experience. It was relatively manual and entirely text based when compared with other Linux distros. I’m happy to report than in 2025, even if you want to dual boot with Windows, is easy. There are however still some manual steps. First, if you’re dual booting I would recommend installing Windows first. This will just make this whole process less error prone. ...

June 28, 2025 · 5 min