HackerPapers

arXiv:1910.05109cs.DC

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

Wojciech Muła, Daniel Lemire

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

Many common document formats on the Internet are text-only such as email (MIME) and the Web (HTML, JavaScript, JSON and XML). To include images or executable code in these documents, we first encode them as text using base64. Standard base64 encoding uses 64~ASCII characters: both lower and upper case Latin letters, digits and two other symbols. We show how we can encode and decode base64 data at nearly the speed of a memory copy (memcpy) on recent Intel processors, as long as the data does not fit in the first-level (L1) cache. We use the SIMD (Single Instruction Multiple Data) instruction set AVX-512 available on commodity processors. Our implementation generates several times fewer instructions than previous SIMD-accelerated base64 codecs. It is also more versatile, as it can be adapted---even at runtime---to any base64 variant by only changing constants.

arXiv comments
Journal reference
Software: Practice and Experience 50 (2), 2020
DOI
doi:10.1002/spe.2777
Subjects
cs.DCDistributed, Parallel, and Cluster Computing

On Hacker News

Linked by 1 identifiable commenter in 1 comment across 1 thread, from Aug 2020 to Aug 2020. Found in 4 HN submissions from Nov 2019 to May 2026. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments1 thread

    • > AVX2 had downclocking issues when it first appeared too - but these were rapidly mitigated and forgotten. Speaking of Daniel Lemire, he recently published a paper https://arxiv.org/abs/1910.05109 mentioning downclocking in section 4: > On some Intel processors, AVX-512…

      jasonzemosView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.