<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/a-space-is-a-bit-in-a-32-byte-table-xsj0gnsbk" -->

---
title: A space is a bit in a 32-byte table | daily.dev
description: A deep technical walkthrough of how the Ada URL library implements SIMD-accelerated percent-encoding using SSSE3's pshufb instruction to classify 16 bytes at...
canonical: https://daily.dev/posts/a-space-is-a-bit-in-a-32-byte-table-xsj0gnsbk
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: A space is a bit in a 32-byte table | daily.dev
og:description: A deep technical walkthrough of how the Ada URL library implements SIMD-accelerated percent-encoding using SSSE3's pshufb instruction to classify 16 bytes at...
og:url: https://daily.dev/posts/a-space-is-a-bit-in-a-32-byte-table-xsj0gnsbk
og:image: https://api.daily.dev/og/posts/xSj0gNSBK.png
og:image:alt: A space is a bit in a 32-byte table
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.

# A space is a bit in a 32-byte table

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

## Summary

A deep technical walkthrough of how the Ada URL library implements SIMD-accelerated percent-encoding using SSSE3's pshufb instruction to classify 16 bytes at once against the WHATWG URL Standard's 32-byte bitmap tables. The approach loads the caller-supplied bitmap directly rather than rebuilding a lookup per call, using a second shuffle and AND to test bit membership, then movemask to find bytes needing %XX escaping. Benchmarks on an Intel Xeon show a mostly-clean 1024-byte query string going from 1.0 GB/s (byte loop) to 9.6 GB/s (SSSE3), while a string of all spaces (no clean runs to skip) is actually slightly slower than the naive byte loop since every lane still needs scalar %XX writing. The piece also covers ARM's single vqtbl2q_u8 instruction alternative, why RISC-V sticks with the byte loop, and why decoding stays scalar.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.yagiz.co/a-space-is-a-bit-in-a-32-byte-table>

## Questions this post answers

### How much faster is SIMD percent-encoding compared to a byte-by-byte loop?

On a mostly clean 1024-byte query string, an SSSE3-based vectorized encoder reached 9.6 GB/s (107 ns) versus 1.0 GB/s (997 ns) for a naive byte loop, roughly a 9x speedup. Copying clean spans alone (no SIMD) got to 1.9 GB/s, meaning the pshufb-based bitmap lookup accounted for most of the remaining gain by skipping 16 bytes per check.

_Developers optimizing string-processing hot paths can find more SIMD encoding breakdowns like this through daily.dev._

### Why is SIMD percent-encoding slower than a scalar loop when every byte needs escaping?

When every byte in the input is a space (or another character needing %XX), there are no clean runs for the vector path to skip, so the shuffle-based classification adds overhead without saving any copy work. In that worst case, 1024 bytes took 1601 ns with the SSSE3 approach versus 1462 ns for the plain byte loop, about 0.64 GB/s versus 0.70 GB/s.

_Anyone weighing SIMD versus scalar string routines for their workload can track these trade-off deep dives 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
- [192.168.1.1 is too short for SIMD](https://daily.dev/posts/192-168-1-1-is-too-short-for-simd-93iczwvbh) · Yagiz Nizipli · 0 upvotes · 0 comments
- [Simple batch decoding of unary codes](https://daily.dev/posts/simple-batch-decoding-of-unary-codes-kyuqotiln) · Ryg blog · 0 upvotes · 0 comments
- [Let's see Paul Allen's SIMD CSV parser](https://daily.dev/posts/let-s-see-paul-allen-s-simd-csv-parser-xr1qamezs) · Lobsters · 0 upvotes · 0 comments
- [.NET Developer, Personal Blog](https://daily.dev/posts/net-developer-personal-blog-vcmvfo0d0) · Laszlo Deak · 1 upvotes · 0 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/a-space-is-a-bit-in-a-32-byte-table-xsj0gnsbk)

```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":"A space is a bit in a 32-byte table","url":"https://daily.dev/posts/a-space-is-a-bit-in-a-32-byte-table-xsj0gnsbk","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/a-space-is-a-bit-in-a-32-byte-table-xsj0gnsbk"},"datePublished":"2026-09-27T02:17:43.405Z","dateModified":"2026-09-27T02:18:08.290Z","description":"A deep technical walkthrough of how the Ada URL library implements SIMD-accelerated percent-encoding using SSSE3's pshufb instruction to classify 16 bytes at...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/efdf0a1c76a161a9cc350f2a63c58e6f?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/efdf0a1c76a161a9cc350f2a63c58e6f?_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/a-space-is-a-bit-in-a-32-byte-table-xsj0gnsbk","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":7},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"performance,c++","timeRequired":"PT7M"}
{"@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":"A space is a bit in a 32-byte table"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/a-space-is-a-bit-in-a-32-byte-table-xsj0gnsbk#faq","mainEntity":[{"@type":"Question","name":"How much faster is SIMD percent-encoding compared to a byte-by-byte loop?","acceptedAnswer":{"@type":"Answer","text":"On a mostly clean 1024-byte query string, an SSSE3-based vectorized encoder reached 9.6 GB/s (107 ns) versus 1.0 GB/s (997 ns) for a naive byte loop, roughly a 9x speedup. Copying clean spans alone (no SIMD) got to 1.9 GB/s, meaning the pshufb-based bitmap lookup accounted for most of the remaining gain by skipping 16 bytes per check. Developers optimizing string-processing hot paths can find more SIMD encoding breakdowns like this through daily.dev."}},{"@type":"Question","name":"Why is SIMD percent-encoding slower than a scalar loop when every byte needs escaping?","acceptedAnswer":{"@type":"Answer","text":"When every byte in the input is a space (or another character needing %XX), there are no clean runs for the vector path to skip, so the shuffle-based classification adds overhead without saving any copy work. In that worst case, 1024 bytes took 1601 ns with the SSSE3 approach versus 1462 ns for the plain byte loop, about 0.64 GB/s versus 0.70 GB/s. Anyone weighing SIMD versus scalar string routines for their workload can track these trade-off deep dives on daily.dev."}}]}
```

