Technology1 min read

Decoding base64 email attachments: a speed ranking of programming languages

By · Published by Everything Blog

In short

Recent benchmarks conducted on an Intel Xeon Gold system evaluated how modern programming languages decode 1.37 megabytes of formatted base64 payloads containing line breaks. Decoders utilizing the simdutf library dominated the results because they eliminate line endings inside vector loops, preventing runtimes from entering slow fallback routines. For instance, PHP ranked last by dropping from twenty gigabytes per second on clean input down to 0.61 gigabytes per second on wrapped MIME data. A pending pull request incorporating simdutf into PHP yields a 28-fold performance boost, elevating the language to second place overall.

Key points

  • Standard line limits in MIME and PEM formats frequently force base64 engines into ineffic…: Standard line limits in MIME and PEM formats frequently force base64 engines into inefficient fallback processing routines.
  • Utilizing vectorized loops to compact blocks with line endings allows decoders to maintai…: Utilizing vectorized loops to compact blocks with line endings allows decoders to maintain high throughput on formatted data.
  • Integrating simdutf routines into PHP provides a 28-fold speedup that lifts its MIME deco…: Integrating simdutf routines into PHP provides a 28-fold speedup that lifts its MIME decoding performance to second place.

Sources checked by our analysis pipeline: 1

20 November 2026 · 3 min

Email attachments are base64. So are cryptographic PEM certificates. In both cases the text is broken into lines, 76 characters for email and 64 for PEM.

Skipping line endings sounds trivial. Yet many fast decoders only work on uninterrupted base64. As soon as they meet a line break, they fall back to a slow path.

How fast can we decode MIME base64 in popular programming languages? I wrote a small benchmark. I generate one megabyte of random bytes, encode it as base64 with 76-character lines ending in CRLF (1.37 MB of text) and decode it again with the standard or most popular function of each language. I check that each decoder returns the right bytes.

I use an Intel Xeon Gold 6548N (Emerald Rapids) with Linux, pinned to one core. I report speeds in gigabytes of input per second (GB/s). Each number is the median of three runs, and each run keeps the best of ten timed batches. I use the latest version of each tool.

There is a factor of thirty between the…

Technology