按年被提到
20192019 · 2 次2026
算法与数据结构›哈希、压缩与向量化·arXiv:1910.05109 · cs.DC

Base64 encoding and decoding at almost the speed of a memory copy

接近内存拷贝速度的 Base64 编解码
Wojciech Muła, Daniel Lemire · 2019

用 AVX-512 让 Base64 编解码速度逼近 memcpy

开始阅读 ↗PDFalphaXiv 讨论
被提及 · 4 人首次 2019-11-05 · 最近 2026-05-17
4不同的人
3活跃月份
4讨论串
11被引(OpenAlex)

论文展示如何利用 AVX-512 SIMD 指令集,在较新的 Intel 处理器上让 Base64 编码和解码在数据不能放进 L1 缓存时接近内存拷贝(memcpy)的速度。实现生成的指令数比以往的 SIMD 加速 Base64 编解码器少好几倍,并且只需改动常量就能(甚至在运行时)适配任何 Base64 变体。

HN 为什么提它

输入里没有保留下来的评论摘录,无法判断 HN 上的人为什么反复提它;只知道它在 2019 至 2026 年间被 4 个人在 3 个月里提及。

方法难度 3 / 5约 40 分钟经得起时间
读之前最好知道
1SIMD 指令集(AVX-512)
2CPU 缓存层级
3Base64 编码规则
4底层性能优化

学习路径

读这篇之前,按顺序读书架上的 2 篇 · 参考文献来自 OpenAlex,顺序和要点由 Claude Code 排出

这条路径先看同一作者用 AVX2 加速 Base64 的前作,再看 simdjson 里的 SIMD 解析思路,最后读用 AVX-512 把 Base64 做到接近内存拷贝速度。

  1. 1

    目标论文是这篇 AVX2 Base64 工作的直接后续,先建立 SIMD 编解码的基本做法。

    读用向量指令把字节重排为 6 位索引再查表翻译的编码流程,以及解码时的校验方式。

  2. 2
    Parsing Gigabytes of JSON per Second每秒解析数 GB 的 JSON(simdjson) · 2019

    同一作者的 SIMD 解析工作,展示如何用向量指令处理字节流并避免分支。

    读只看如何用 SIMD 批量分类字符、减少分支的思路;JSON 结构解析部分可略读。

  3. 3
    Base64 encoding and decoding at almost the speed of a memory copy接近内存拷贝速度的 Base64 编解码 · 2019 · 就是这篇

    目标论文:用 AVX-512 指令把 Base64 编解码速度推到接近 memcpy。

    读AVX-512 下的字节重排与查表指令、与 AVX2 版本的差别,以及数据不在 L1 缓存时速度逼近内存拷贝的评测。

HN 书评

没有评论直接链到它;下面是它被提交的讨论串里回复最多的评论(不计入统计)
讨论串评论jason0597 · 2019-11

“Now this is the programming I like, low-level assembly optimisation of long operations, none of this web development rubbish”

Base64 encoding and decoding at almost the speed of a memory copy原评论 ↗
讨论串评论usr1106 · 2019-11

“Why is that an achievement? Isn't it so that during a memory copy the CPU is basically idling because memory is so much slower than the CPU? Weren't that hundreds of instructions per memory access? So instead of having it wait it can also do computations (just standard instructions). Or is base64 computationally so heavy that it cannot fit into the "gaps"…”

Base64 encoding and decoding at almost the speed of a memory copy原评论 ↗
讨论串评论londons_explore · 2019-11

“If base64 decoding speed makes a difference in your application, you should be considering why you are transmitting data in base64, a neat hack from the 1970's, which is non-human-readable, wastes 30% of the network bandwidth, kills compression, wastes RAM, is typically hard to random-access, and is generally a bad idea all round.”

Base64 encoding and decoding at almost the speed of a memory copy原评论 ↗
被提交为 story · 4 次