---
title: "Everyone Should Know SIMD"
url: https://daily.dev/posts/everyone-should-know-simd-jggqusevq
source_url: https://mitchellh.com/writing/everyone-should-know-simd
type: article
source: "Mitchell Hashimoto"
published: 2026-07-22T17:48:31.532Z
updated: 2026-07-23T14:54:28.675Z
tags: ["performance", "zig"]
reading_time: 12
upvotes: 3
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Everyone Should Know SIMD

**[Mitchell Hashimoto](https://daily.dev/sources/mitchellh)** · 12 min read · 3 upvotes · 0 comments

## Summary

SIMD (Single Instruction, Multiple Data) is often dismissed as too complex, but the common case follows a simple five-step pattern: broadcast constants, loop one vector-width chunk at a time, perform the parallel operation, reduce the result, and handle the scalar tail. Using Zig and a real example from the Ghostty terminal emulator, the post walks through converting a scalar byte-scanning loop into a generic SIMD implementation that achieves 4x–8x throughput gains without CPU-specific intrinsics. The post argues that every developer should recognize SIMD opportunities in hot loops and not be intimidated by the technique, since the common shape is nearly as straightforward as writing a regular for loop.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://mitchellh.com/writing/everyone-should-know-simd>

## Community take

How the wider developer community reacted, aggregated from 1 discussion and 329 comments across hackernews (as of 2026-07-23).

**TL;DR:** The community is broadly skeptical that "everyone" needs to know SIMD, with many arguing auto-vectorization covers most cases and that data layout (AoS vs SoA) and algorithmic improvements matter more; a vocal minority defends hand-written SIMD for hot paths where compilers fall short.

**Sentiment:** 25% positive · 45% mixed · 30% skeptical

**The case for**

- Hand-written SIMD can unlock significant gains on hot paths that compilers fail to auto-vectorize, especially loops with early breaks.
- Understanding SIMD helps developers recognize when it's not worth using and how to structure code so compilers can vectorize automatically.
- Runtime CPU dispatch (e.g., via Google Highway) lets redistributed software exploit AVX-512 on capable machines without sacrificing baseline compatibility.
- Data-oriented design (SoA, cache-friendly layouts) pairs naturally with SIMD and often yields large speedups even before any explicit SIMD is written.

**The pushback**

- 99% of developers should ignore SIMD; most codebases have far more impactful low-hanging fruit (DB round trips, bad algorithms, cache locality).
- Auto-vectorization with -O3 and -march=native is surprisingly capable, and the article's own example shows the compiler reaching ~77% of hand-crafted performance without effort.
- The article's claim that "writing SIMD is just about as easy as a for loop" is misleading—the first example requires 12 lines to replace one scalar line.
- SIMD requires restructuring data (AoS→SoA) and algorithms, which is a large semantic shift for a 2–5× gain that may not be justified.
- Historical AVX-512 frequency downclocking issues on Skylake server CPUs caused hard-to-debug cluster-wide slowdowns, a cautionary tale about SIMD adoption.
- The article uses SIMD-specific jargon (e.g., "broadcast") before defining it, making it inaccessible to the target beginner audience.

**By community**

- hackernews (mixed): Commenters are split between defending hand-written SIMD for critical hot paths and arguing that auto-vectorization, better data layouts, and algorithmic fixes are more practical for the vast majority of developers.

**Hottest debate:** Whether auto-vectorization is good enough to make hand-written SIMD unnecessary for most developers, or whether compilers reliably fall short in ways that justify learning explicit SIMD.

**Open questions**

- Is there a language or compiler annotation (e.g., [[must_vectorize]]) that could turn failed auto-vectorization into a compile error rather than a silent fallback to scalar code?
- When will a mainstream language support best-effort parallelization across SIMD, threads, and GPU with a simple directive?
- Will Zig ever support runtime CPU dispatch for SIMD vectors, removing the need to pull in C++ libraries like Google Highway?

**Highlights**

> Case-in-point, the example in my own post doesn't auto-vectorize with LLVM or GCC at highest optimization levels. Basically, compilers will never auto-vectorize loops with an early loop break afaik.
> — [mitchellh on hackernews · 1 comments](https://news.ycombinator.com/item?id=49012311)

> > mitchell, i know you hang around some of these comments sometimes hi im here > i noticed that in ghostty you bring in some c++ libs to do the simd heavy lifting for you. any plans to port that to zig? anything missing from the language or libs that's preventing it? No plans to port it. For others, this is referencing highway: https://github.com/google/highway The major limitation of Zig's vectors is that they're compile-time only. So if you're building redistributed software that compiles for a baseline CPU target, it won't be as optimized as it could be for YOUR possible machine. Highway compiles our SIMD modules for different hardware configurations and at startup does a CPUID fingerprint to figure out which to load. That way even baseline has AVX512 etc. implementations, and we just activate the right one at runtime. We only use Highway for our hottest hot paths that we feel benefit from that specialization. No plans to port that (although, I spent hundreds of dollars and slop-forked it into Zig with the help of this good boy GPT and it worked great actually, but I didn't want to maintain it).
> — [mitchellh on hackernews · 2 comments](https://news.ycombinator.com/item?id=49012420)

> Good article! I just wouldn't start off with bold sentences as > SIMD can be simple to understand and > writing SIMD is just about as easy as a for loop and then the first example requires 12 lines to replace one line of scalar code. Be honest and say SIMD is hard but the results are worth it! (Another nitpick: if this article is for newbies, don't use SIMD-only words and concpts before explaining them. Step 5 is good: scalar tails are mentioned and described. Step 1 is bad: nobody is supposed to know what broadcast mean.)
> — [teo\_zero on hackernews · 9 comments](https://news.ycombinator.com/item?id=49017488)

> A good introduction to SoA (for anyone curious) are the two most famous Data-Oriented Design talks by Mike Acton (game engine dev) [1] and Andrew Kelley (Zig lead dev) [2] respectively. I read a book book about DoD [3] really which confused me at first with all its talk about database table design (in a book about a high-performance C++ game engine?), but when it finally clicked it was amazing. The point is that you want to think hard about your access patterns and what could constitute good "primary keys", then model it accordingly. SoA ends up being useful a lot of the time, because having your data in homogeneous arrays/vectors is great for cache locality and branch elimination. Even without SIMD you can get huge speedups from that, but that's also where your compiler (or you as a programmer) can get incredible SIMD gains. SoA is not a silver bullet as it may not align well with your access patterns, but it can great to add to your toolkit. --- Mike Acton: Data-Oriented Design and C++: https://www.youtube.com/watch?v=rX0ItVEVjHc Andrew Kelley: A Practical Guide to Applying Data Oriented Design: https://www.youtube.com/watch?v=IroPQ150F6c Richard Fabian: Data-Oriented Design: https://www.dataorienteddesign.com/dodbook/
> — [Rendello on hackernews](https://news.ycombinator.com/item?id=49012929)

> 99% of developers should just ignore SIMD. Most projects have a lot of low hanging fruit to increase performance, and still nobody finds the time to solve them.
> — [andix on hackernews · 1 comments](https://news.ycombinator.com/item?id=49013038)

**Source threads**

- [hackernews](https://news.ycombinator.com/item?id=49010648) · 388 points · 329 comments

## Similar posts on daily.dev

- [Why We Need SIMD \(The Real Reason\)](https://daily.dev/posts/why-we-need-simd-the-real-reason--sne5fy70g) · Hacker News · 4 upvotes · 0 comments

---

Tags: [#performance](https://daily.dev/tags/performance), [#zig](https://daily.dev/tags/zig)

[View this post on daily.dev](https://daily.dev/posts/everyone-should-know-simd-jggqusevq)
