<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/192-168-1-1-is-too-short-for-simd-93iczwvbh" -->

---
title: 192.168.1.1 is too short for SIMD | daily.dev
description: A deep technical breakdown of parsing IPv4 addresses inside a URL host parser (Ada), arguing that SIMD is often the wrong tool because an IPv4 address is only...
canonical: https://daily.dev/posts/192-168-1-1-is-too-short-for-simd-93iczwvbh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: 192.168.1.1 is too short for SIMD | daily.dev
og:description: A deep technical breakdown of parsing IPv4 addresses inside a URL host parser (Ada), arguing that SIMD is often the wrong tool because an IPv4 address is only...
og:url: https://daily.dev/posts/192-168-1-1-is-too-short-for-simd-93iczwvbh
og:image: https://api.daily.dev/og/posts/93iCzwvBH.png
og:image:alt: 192.168.1.1 is too short for SIMD
og:image:width: 1200
og:image:height: 630
og:locale: 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.

# 192.168.1.1 is too short for SIMD

**[Yagiz Nizipli](https://daily.dev/sources/yagiz)** · 15 min read · 0 upvotes · 0 comments

## Summary

A deep technical breakdown of parsing IPv4 addresses inside a URL host parser (Ada), arguing that SIMD is often the wrong tool because an IPv4 address is only 7-16 bytes and never fills a register. The author benchmarks several approaches on an Intel Xeon: an unrolled scalar parser, a SWAR fold (which loses to simple multiply-by-ten), SSE2 pre-validation (a tie with scalar), Wojciech Muła's locate-then-scalar SSE, a table-free AVX-512 VBMI2 kernel using masked loads and vpcompressb, and simdzone's 81-mask SSE table lookup. Results: inet_pton at 30ns/addr, unrolled scalar at 16ns, AVX-512 VBMI2 at 4.5ns, and simdzone's padded 81-mask SSE fastest at 3.1ns. The piece also covers WHATWG's quirky IPv4 grammar (hex, octal, shorthand forms like 127.1) and briefly extends the analysis to IPv6 parsing complexity with a masked-load plausibility pre-check.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.yagiz.co/simd-is-the-wrong-way-to-parse-ipv4>

## Questions this post answers

### Why doesn't SSE2 pre-validation speed up IPv4 address parsing before running the scalar parser?

Because on a 2.4 GHz Intel Xeon benchmark it results in a tie with the plain unrolled scalar parser, sometimes losing by a nanosecond. Adding a 16-byte load, three compares, a movemask, and a popcount in front of a function you already have to run does not pay for itself, and it also forces an unsafe 16-byte over-read on a 7-16 byte IPv4 host.

_Anyone chasing real numbers before adding SIMD pre-checks can compare optimization writeups like this on daily.dev._

### How fast is a table-free AVX-512 VBMI2 IPv4 parser compared to unrolled scalar C++ code?

About four times faster: 4.5 ns per address (220 million addresses/second) versus 16 ns for unrolled scalar parsing, measured on an Intel Xeon with GCC 13.3 and AVX-512BW/VL/VBMI2/VNNI. The AVX-512 version uses a masked load to read exactly the live bytes, then vpcompressb to gather dot positions and compute a digit shuffle without any lookup table, unlike SSE approaches that require 16-byte padding.

_Engineers deciding between AVX-512 and scalar code paths can find concrete benchmark breakdowns like this on daily.dev._

### Why does converting three decimal digits with a SWAR bit-fold perform worse than multiplying by ten incrementally?

A SWAR fold that loads three digit bytes as a uint32_t, subtracts '0', reverses digit order, and multiplies by weights 1, 10, 100 turned out twice as slow as simply accumulating value*10+digit in a loop. The load, byte reversal, and three-term add are extra overhead on a group that is only two or three bytes long, since SWAR techniques are designed for eight-byte registers, not single IPv4 octets.

_Developers weighing bit-twiddling tricks against simple loops for micro-optimizations can dig into benchmarks like this on daily.dev._

## Similar posts on daily.dev

- [Eight bytes in one register](https://daily.dev/posts/eight-bytes-in-one-register-mloumcpw2) · Yagiz Nizipli · 2 upvotes · 0 comments
- [The shortest IPv6 addresses](https://daily.dev/posts/the-shortest-ipv6-addresses-hsi4qss8b) · Lobsters · 0 upvotes · 0 comments
- [A space is a bit in a 32-byte table](https://daily.dev/posts/a-space-is-a-bit-in-a-32-byte-table-xsj0gnsbk) · Yagiz Nizipli · 7 upvotes · 0 comments
- [Everyone Should Know SIMD](https://daily.dev/posts/everyone-should-know-simd-jggqusevq) · Mitchell Hashimoto · 3 upvotes · 0 comments
- [C\+\+26 Shipped a SIMD Library Nobody Asked For](https://daily.dev/posts/c-26-shipped-a-simd-library-nobody-asked-for-olmtt2aj7) · Hacker News · 7 upvotes · 1 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/192-168-1-1-is-too-short-for-simd-93iczwvbh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"192.168.1.1 is too short for SIMD","url":"https://daily.dev/posts/192-168-1-1-is-too-short-for-simd-93iczwvbh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/192-168-1-1-is-too-short-for-simd-93iczwvbh"},"datePublished":"2026-09-13T19:57:43.567Z","dateModified":"2026-09-13T20:00:16.530Z","description":"A deep technical breakdown of parsing IPv4 addresses inside a URL host parser (Ada), arguing that SIMD is often the wrong tool because an IPv4 address is only...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4ebffd1277f08666a3192eb1f7c14baf?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/4ebffd1277f08666a3192eb1f7c14baf?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Yagiz Nizipli","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Yagiz Nizipli","logo":"https://media.daily.dev/image/upload/s--9Cscmaqk--/f_auto,q_auto/v1789329427/logos/yagiz?_a=BAMAMicg0","url":"https://daily.dev/sources/yagiz"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/192-168-1-1-is-too-short-for-simd-93iczwvbh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"performance,c++","timeRequired":"PT15M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Yagiz Nizipli","item":"https://daily.dev/sources/yagiz"},{"@type":"ListItem","position":3,"name":"192.168.1.1 is too short for SIMD"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/192-168-1-1-is-too-short-for-simd-93iczwvbh#faq","mainEntity":[{"@type":"Question","name":"Why doesn't SSE2 pre-validation speed up IPv4 address parsing before running the scalar parser?","acceptedAnswer":{"@type":"Answer","text":"Because on a 2.4 GHz Intel Xeon benchmark it results in a tie with the plain unrolled scalar parser, sometimes losing by a nanosecond. Adding a 16-byte load, three compares, a movemask, and a popcount in front of a function you already have to run does not pay for itself, and it also forces an unsafe 16-byte over-read on a 7-16 byte IPv4 host. Anyone chasing real numbers before adding SIMD pre-checks can compare optimization writeups like this on daily.dev."}},{"@type":"Question","name":"How fast is a table-free AVX-512 VBMI2 IPv4 parser compared to unrolled scalar C++ code?","acceptedAnswer":{"@type":"Answer","text":"About four times faster: 4.5 ns per address (220 million addresses/second) versus 16 ns for unrolled scalar parsing, measured on an Intel Xeon with GCC 13.3 and AVX-512BW/VL/VBMI2/VNNI. The AVX-512 version uses a masked load to read exactly the live bytes, then vpcompressb to gather dot positions and compute a digit shuffle without any lookup table, unlike SSE approaches that require 16-byte padding. Engineers deciding between AVX-512 and scalar code paths can find concrete benchmark breakdowns like this on daily.dev."}},{"@type":"Question","name":"Why does converting three decimal digits with a SWAR bit-fold perform worse than multiplying by ten incrementally?","acceptedAnswer":{"@type":"Answer","text":"A SWAR fold that loads three digit bytes as a uint32_t, subtracts '0', reverses digit order, and multiplies by weights 1, 10, 100 turned out twice as slow as simply accumulating value*10+digit in a loop. The load, byte reversal, and three-term add are extra overhead on a group that is only two or three bytes long, since SWAR techniques are designed for eight-byte registers, not single IPv4 octets. Developers weighing bit-twiddling tricks against simple loops for micro-optimizations can dig into benchmarks like this on daily.dev."}}]}
```

