This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients gvanrossum
Date 2012-06-22.14:59:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1340377200.19.0.907616925756.issue15138@psf.upfronthosting.co.za>
In-reply-to
Content
This bug is still present in Python 3.3.  Some people use urlsafe strings *a lot*. And they find that the (obvious) implementation in base64.py is way too slow.  In fact, I found myself writing the following a few times in App Engine libraries:

    # This is 3-4x faster than urlsafe_b64decode()                   
    urlsafe = base64.b64encode(<arg>)
    return urlsafe.rstrip('=').replace('+', '-').replace('/', '_')

Someone from YouTube told me they patch the stdlib for the same reason (they claim their solution is 10x faster).

IIUC the cause of the slowness is the (mostly irrelevant) generality in b64encode and the _translate() function.
History
Date User Action Args
2012-06-22 15:00:00gvanrossumsetrecipients: + gvanrossum
2012-06-22 15:00:00gvanrossumsetmessageid: <1340377200.19.0.907616925756.issue15138@psf.upfronthosting.co.za>
2012-06-22 14:59:59gvanrossumlinkissue15138 messages
2012-06-22 14:59:58gvanrossumcreate