Message163420
| 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:00 | gvanrossum | set | recipients:
+ gvanrossum |
| 2012年06月22日 15:00:00 | gvanrossum | set | messageid: <1340377200.19.0.907616925756.issue15138@psf.upfronthosting.co.za> |
| 2012年06月22日 14:59:59 | gvanrossum | link | issue15138 messages |
| 2012年06月22日 14:59:58 | gvanrossum | create |
|