Skip to content

C accelerator for Base32 character encoding #146192

Description

@kangtastic

Proposal:

The base64 module contains implementations of encoders/decoders for several character encodings.

Among these are the base32 and base32hex encodings mentioned in RFC 4648.

These are currently implemented in pure Python. Implementing them in C will greatly improve performance (~100x) and memory usage.

I have written a draft PR that accomplishes this, and will be submitting it shortly.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

Suggested by @serhiy-storchaka in #102753.

Linked PRs

Activity

  1. added 2 commits that reference this issue on Mar 20, 2026
  2. serhiy-storchaka commented on Mar 20, 2026

    @serhiy-storchaka
    Member

    The Base 32 codec is the only one which is implemented in pure Python. This not only makes it slower and increases memory consumption (the same issue as was with the Base 85 codec, see #101178), but it makes difficult to add new features, code for which can be shared between other codecs implemented in C. So, rewriting it in C will help with maintenance.

  3. added
    performancePerformance or resource usage
    stdlibStandard Library Python modules in the Lib/ directory
    on Mar 20, 2026
  4. added and removed
    stdlibStandard Library Python modules in the Lib/ directory
    on Mar 20, 2026
  5. added a commit that references this issue on Mar 20, 2026
  6. added a commit that references this issue on Mar 22, 2026
  7. added a commit that references this issue on Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirperformancePerformance or resource usagetype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions