arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 1910.05109cs.DC
收藏

Base64编码和解码速度几乎与内存拷贝相同

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

Wojciech Muła, Daniel Lemire

摘要:

Internet上的许多常见文档格式都是纯文本格式,例如电子邮件(MIME)和Web(HTML、JavaScript、JSON和XML)。为了在这些文档中包含图像或可执行代码,我们首先使用base64将它们编码为文本。标准base64编码使用64~ASCII字符:小写和大写拉丁字母、数字和其他两个符号。我们展示了如何在最近的英特尔处理器上以接近内存复制(memcpy)的速度对base64数据进行编码和解码,只要数据不适合第一级(L1)缓存。我们使用的SIMD(单指令多数据)指令集AVX-512可在商品处理器。我们的实现生成的指令比以前的SIMD加速的base64编解码器少几倍。它也更通用,因为它可以适应-甚至在运行时-通过只改变常量来适应任何base64变体。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑