Abstract
Web developers use base64 formats to include images, fonts, sounds, and other resources directly inside HTML, JavaScript, JSON, and XML files. We estimate that billions of base64 messages are decoded every day. We are motivated to improve the efficiency of base64 encoding and decoding. Compared to state-of-the-art implementations, we multiply the speeds of both the encoding (≈ 10 ×0) and the decoding (≈ 7 ×). We achieve these good results by using the single-instruction-multiple-data instructions available on recent Intel processors (AVX2). Our accelerated software abides by the specification and reports errors when encountering characters outside of the base64 set. It is available online as free software under a liberal license.
- Amazon 2015. Amazon SimpleDB. Retrieved from http://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/Welcome.html.Google Scholar
- Amazon 2017. Amazon DynamoDB. Retrieved from http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Introduction.html.Google Scholar
- ARM 2017. The Scalable Vector Extension (SVE), for ARMv8-A. Technical Report. ARM Holdings, Cambridge, UK. Retrieved from https://static.docs.arm.com/ddi0584/a/DDI0584A_a_SVE_supp_armv8A.pdf.Google Scholar
- David Calhoun. 2011. When to base64 encode images (and when not to). Retrieved from http://davidbcalhoun.com/2011/when-to-base64-encode-images-and-when-not-to/.Google Scholar
- Hanson Char. 2014. A fast and correct base 64 codec. Retrieved from https://aws.amazon.com/blogs/developer/a-fast-and-correct-base-64-codec/.Google Scholar
- Matt Crane and Jimmy Lin. 2017. An exploration of serverless architectures for information retrieval. In Proceedings of the ACM SIGIR International Conference on Theory of Information Retrieval (ICTIR’17). ACM, New York, NY, 241--244. Google Scholar
Digital Library
- Mark Davis. 2012. Unicode over 60 percent of the web. Retrieved from https://googleblog.blogspot.ca/2012/02/unicode-over-60-percent-of-web.html.Google Scholar
- Elastic 2017. Elasticsearch reference-Binary datatype. Retrieved from https://www.elastic.co/guide/en/elasticsearch/reference/current/binary.html.Google Scholar
- Pierre Estérie, Joel Falcou, Mathias Gaunard, and Jean-Thierry Lapresté. 2014. Boost.SIMD: Generic programming for portable SIMDization. In Proceedings of the Workshop on Programming Models for SIMD/Vector Processing (WPMVP’14). ACM, New York, NY, 1--8. Google Scholar
Digital Library
- Tammy Everts. 2013. Rules for mobile performance optimization. Commun. ACM 56, 8 (Aug. 2013), 52--59. Google Scholar
Digital Library
- Roy T. Fielding, James Gettys, Jeffrey C. Mogul, Henrik Frystyk Nielsen, Larry Masinter, Paul J. Leach, and Tim Berners-Lee. 1999. Hypertext transfer protocol-HTTP/1.1. Retrieved from https://tools.ietf.org/html/rfc2616. Google Scholar
Digital Library
- Agner Fog. 2016. Instruction Tables: Lists of Instruction Latencies, Throughputs and Micro-operation Breakdowns for Intel, AMD and VIA CPUs. Technical Report. Copenhagen University College of Engineering, Copenhagen, Denmark. Retrieved from http://www.agner.org/optimize/instruction_tables.pdf.Google Scholar
- Ned Freed and Nathaniel S. Borenstein. 1996. Multipurpose internet mail extensions (MIME) Part One: Format of internet message bodies. Retrieved from https://tools.ietf.org/html/rfc2045. Google Scholar
Digital Library
- Nick Galbreath. 2016. Fast c-string transformations. Retrieved from https://github.com/client9/stringencoders.Google Scholar
- Ian Hickson. 2016. Web storage. Retrieved from https://www.w3.org/TR/webstorage/.Google Scholar
- Richard Duchatsch Johansen, Talita Cristina Pagani Britto, and Cesar Augusto Cusin. 2013. CSS browser selector plus: A JavaScript library to support cross-browser responsive design. In Proceedings of the 22nd International Conference on World Wide Web (WWW’13). ACM, New York, NY, 27--30. Google Scholar
Digital Library
- Michael B. Jones, John Bradley, and Nat Sakimura. 2015. JSON web signature (JWS). Retrieved from https://tools.ietf.org/html/rfc7515.Google Scholar
- Simon Josefsson. 2006. The base16, base32, and base64 data encodings. Retrieved from https://tools.ietf.org/html/rfc4648.Google Scholar
- Alfred Klomp. 2014a. Fast base64 encoding/decoding with SSE vectorization. Retrieved from http://www.alfredklomp.com/programming/sse-base64/.Google Scholar
- Alfred Klomp. 2014b. Fast base64 stream encoder/decoder in C99, with SIMD acceleration. Retrieved from https://github.com/aklomp/base64.Google Scholar
- Nick Kopp. 2013. Base64 encoding on a GPU. Retrieved from https://www.codeproject.com/Articles/276993/Base-Encoding-on-a-GPU.Google Scholar
- John Linn. 1993. Privacy enhancement for internet electronic mail: Part I: Message encryption and authentication procedures. Retrieved from https://tools.ietf.org/html/rfc1421.Google Scholar
- Larry Masinter. 1998. The “data” URL scheme. Retrieved from https://tools.ietf.org/html/rfc2397.Google Scholar
- Microsoft 2017. XML data (SQL server)-Use the binary base64 option. Retrieved from https://www.elastic.co/guide/en/elasticsearch/reference/current/binary.html.Google Scholar
- MongoDB 2017. MongoDB extended JSON. Retrieved from https://docs.mongodb.com/manual/reference/mongodb-extended-json/.Google Scholar
- Thomas Nägele. 2015. Client-side Performance Profiling of JavaScript for Web Applications. Master’s thesis. Radboud University Nijmegen, The Netherlands.Google Scholar
- Gabriele Paoloni. 2010. How to Benchmark Code Execution Times on Intel IA-32 and IA-64 Instruction Set Architectures. Intel Corporation, Santa Clara, CA.Google Scholar
- Guru Prasad Srinivasa, Rizwana Begum, Scott Haseley, Mark Hempstead, and Geoffrey Challen. 2017. Separated by birth: Hidden differences between seemingly-identical smartphone CPUs. In Proceedings of the 18th International Workshop on Mobile Computing Systems and Applications (HotMobile’17). ACM, New York, NY, 103--108. Google Scholar
Digital Library
- Yi Tang and Manjia Lin. 2015. EQPO: Obscuring encrypted web traffic with equal-sized pseudo-objects. In Proceedings of the International Conference on Information Security and Cryptology. Springer, New York, 227--245. Google Scholar
Digital Library
- Matt Tierney, Ian Spiro, Christoph Bregler, and Lakshminarayanan Subramanian. 2013. Cryptagram: Photo privacy for online social media. In Proceedings of the 1st ACM Conference on Online Social Networks (COSN’13). ACM, New York, NY, 75--88. Google Scholar
Digital Library
- Haichuan Wang, Peng Wu, Ilie Gabriel Tanase, Mauricio J. Serrano, and José E. Moreira. 2014. Simple, portable, and fast SIMD intrinsic programming: Generic SIMD library. In Proceedings of the Workshop on Programming Models for SIMD/Vector Processing (WPMVP’14). ACM, New York, NY, 9--16. Google Scholar
Digital Library
Index Terms
Faster Base64 Encoding and Decoding Using AVX2 Instructions
Recommendations
Development of low power MPEG1/JPEG encode/decode IC
We have developed a low power MPEG1 (Moving Picture Expert Group)/JPEG (Joint Photographic Expert Group) encode/decode single chip IC (codec). Using compact ME (motion estimation) process and a power management function we realize a low power ...
Retargetable code optimization with SIMD instructions
CODES+ISSS '06: Proceedings of the 4th international conference on Hardware/software codesign and system synthesisRetargetable C compilers are nowadays widely used to quickly obtain compiler support for new embedded processors and to perform early processor architecture exploration. One frequent concern about retargetable compilers, though, is their lack of machine-...






Comments