---
title: "SIMD Matters"
description: "Box2D 3.0 solves contact constraints with SIMD by using greedy graph coloring to group constraints so no body appears twice within a color."
url: "https://swe.quest/articles/simd-matters-f3febffdc470bd02"
canonical: "https://box2d.org/posts/2024/08/simd-matters/"
source: "Box2D"
published: "2024-08-19"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 8
tags: ["performance","gaming","algorithms","c-cpp","hardware"]
---

# SIMD Matters

A post on [Box2D](https://swe.quest/sources/box2d.md), published 2024-08-19, 8 min read, Deep dive. Original: [https://box2d.org/posts/2024/08/simd-matters/](https://box2d.org/posts/2024/08/simd-matters/)

## Summary

Box2D 3.0 solves contact constraints with SIMD by using greedy graph coloring to group constraints so no body appears twice within a color. Each color is split into 4- or 8-wide blocks for SSE2/Neon/AVX2, with body velocities gathered into wide structs and scattered back afterward. Colors persist across time steps using per-color body bitsets, and static bodies are excluded to keep the color count low. On a 5050-body pyramid benchmark, SSE2 is about 2x faster than scalar and AVX2 about 14% faster than SSE2, while compiler auto-vectorization of a scalar struct-of-floats fallback fails to match hand-written SSE2.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Games](https://swe.quest/tags/gaming.md) (Domains)
- [Algorithms](https://swe.quest/tags/algorithms.md) (Architecture & design)
- [C & C++](https://swe.quest/tags/c-cpp.md) (Languages)
- [Hardware](https://swe.quest/tags/hardware.md) (Infrastructure)

## Prerequisites

- SIMD intrinsics
- rigid body physics solvers
- graph coloring basics

## Keywords

Box2D, SIMD, AVX2, SSE2, Neon, graph coloring, Bepu Physics, Soft Step solver

## Related posts

- [Box2D 3.1](https://swe.quest/articles/box2d-3-1-d8698258cbab254f.md): Box2D · 2025-04-19 · Medium · 2 min read · Games, Performance engineering, C & C++
  Box2D 3.1 fixes most bugs and build problems from 3.0 and adds an experimental geometric character mover built from collision queries and a specialized solver that runs outside the physics world.
- [SIMD for Collision](https://swe.quest/articles/simd-for-collision-0a426a9583188633.md): Box2D · 2026-07-18 · Hard · 5 min read · Performance engineering, Games, Algorithms, C & C++
  Box3D uses wide SIMD to speed up the edge-edge phase of the Separating Axis Test, testing one edge of hull A against four edges of hull B at once using structure-of-arrays data.
- [Box2D 3.2](https://swe.quest/articles/box2d-3-2-6bf0b6359f7de39c.md): Box2D · 2026-10-18 · Easy · 2 min read · Games, Performance engineering, C & C++
  Box2D 3.2 runs roughly three times faster than 3.1, with the speedup broken down by source: contact recycling (~40%), solver algorithm refinement (~20%), AVX2 runtime dispatch (~15%), solver optimization (~10%) and broad-phase optimization (~10%), which compound multiplicatively.
- [Platform-independent SIMD in Go](https://swe.quest/articles/platform-independent-simd-in-go-f8d408cca35d2358.md): The Go Blog · 2026-09-24 · Hard · 18 min read · Go, Performance engineering, Hardware, Compilers, API design
  Go 1.27 adds an experimental, size-agnostic \`simd\` package, loosely modeled on Highway for C++.
- [Arch-specific SIMD in Go](https://swe.quest/articles/arch-specific-simd-in-go-2992a831c4663686.md): The Go Blog · 2026-10-02 · Hard · 11 min read · Go, Performance engineering, Compilers, Hardware, WebAssembly
  Go 1.27 extends the experimental architecture-specific SIMD API (simd/archsimd, enabled with GOEXPERIMENT=simd) from amd64 to arm64 NEON and wasm 128-bit SIMD.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
