Skip to content

feature : Add AVX2 base64 codec - #3684

Open
songgaoye wants to merge 3 commits into
apache:masterfrom
songgaoye:feature/base64-aklomp
Open

songgaoye wants to merge 3 commits into
apache:masterfrom
songgaoye:feature/base64-aklomp

Conversation

@songgaoye

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: resolve

Problem Summary:

Base64 encoding and decoding use scalar implementations on x86 even when AVX2 is available, limiting throughput for medium and large payloads.
What is changed and the side effects?
Changed:

  • Add an AVX2 Base64 codec derived from aklomp/base64, with BSD-2-Clause attribution.

  • Dispatch to AVX2 only on supported x86 CPUs.

  • Use measured thresholds to retain the scalar path for small inputs:

    • Encode: AVX2 from 32 bytes.
    • Decode: AVX2 from 256 bytes of Base64 text.
  • Add unit and fuzz coverage for binary round trips and invalid input.

  • Add reproducible scalar and AVX2 benchmark targets via BUILD_BASE64_BENCHMARKS.
    Side effects:

  • Performance effects:

    • On an Intel i7-10700, AVX2 improves encode throughput by roughly 5–12x and decode throughput by roughly 1.4–4.7x for sufficiently large inputs.
    • Small payloads continue to use the scalar path.
  • Breaking backward compatibility:


Check List:

@wwbmmm
wwbmmm requested a balanced review from Copilot October 28, 2026 05:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants