[issue15138] base64.urlsafe_b64**code are too slow

2015-07-30 Thread Guido van Rossum
Guido van Rossum added the comment: And just in case someone objects to my breaking the policy stated by Antoine in msg163432: see http://bugs.python.org/issue4753 -- it's not actually a real policy. -- versions: +Python 2.7 ___ Python tracker

[issue15138] base64.urlsafe_b64**code are too slow

2015-07-30 Thread Roundup Robot
Roundup Robot added the comment: New changeset 309cbbc32491 by Guido van Rossum in branch '2.7': Issue #15138: Speed up base64.urlsafe_b64* considerably (2.7 backport). https://hg.python.org/cpython/rev/309cbbc32491 -- nosy: +python-dev ___ Python tra

[issue15138] base64.urlsafe_b64**code are too slow

2015-07-30 Thread Guido van Rossum
Guido van Rossum added the comment: I'm going to apply the 2.7 patch, except I'm going to leave the (now unused) _translate() function in place, in case it's used anywhere (minimizing the risk of breaking anything). -- ___ Python tracker

[issue15138] base64.urlsafe_b64**code are too slow

2015-05-30 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: Here's a backport of the patch to 2.7. It's pretty rad, and basically identical to how YouTube monkeypatches base64. Not sure what will happen to this patch. According to recent discussion on the list (e.g. https://mail.python.org/pipermail/python-dev/2015-M

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Guido van Rossum
Guido van Rossum added the comment: Submitted. -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: I haven't tested the patch, but it looks fine to me. -- versions: -Python 3.4 ___ Python tracker ___ _

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Guido van Rossum
Changes by Guido van Rossum : -- assignee: -> gvanrossum stage: needs patch -> patch review ___ Python tracker ___ ___ Python-bugs-li

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Guido van Rossum
Guido van Rossum added the comment: So, can I check this into 3.3? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: Antoine thinks so: http://bugs.python.org/issue15139 :-) I think we should have an official policy, though. -- ___ Python tracker ___ ___

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Guido van Rossum
Guido van Rossum added the comment: I didn't touch that assert. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You're faster than me. I think that asserts should be replaced by if/raise. -- ___ Python tracker ___ __

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Guido van Rossum
Guido van Rossum added the comment: Heh. I'd forgotten about maketrans. Here's a patch that kills the _translate() helper function completely. -- Added file: http://bugs.python.org/file26088/base64.patch ___ Python tracker

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: $ ./python -m timeit -s "from base64 import urlsafe_b64encode; url=bytes(range(256))" "urlsafe_b64encode(url)" 1 loops, best of 3: 73.5 usec per loop $ ./python -m timeit -s "from base64 import b64encode; url=bytes(range(256))" "b64encode(url).replace(b

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Guido van Rossum
Guido van Rossum added the comment: Here's a patch. It makes urlsafe_b64{en,de}code about 4x faster on my machine. The tests in base64_test.py still pass. -- keywords: +patch Added file: http://bugs.python.org/file26087/base64.patch ___ Python tra

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Do we have a policy that forbids performance enhancements in bugfix > releases? Yes, except when it fixes a regression. I don't know where that policy is codified, but it seems quite ingrained. It also means the window for getting it in 3.3 is getting narrow

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Guido van Rossum
Guido van Rossum added the comment: Why would it be a feature? There is no change in semantics, only in speed. Do we have a policy that forbids performance enhancements in bugfix releases? (It doesn't really matter, I'm just curious. Also, if it really was a feature request, it couldn't b

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: Guido, would your patch be enough?. Is a 3x improvement enough?. What improvement could be acceptable?. Implemented in C in "binascii" module? -- ___ Python tracker

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: This is a feature request, not a bug. Marking for 3.3. -- nosy: +jcea versions: -Python 2.6, Python 2.7, Python 3.1, Python 3.2 ___ Python tracker __

[issue15138] base64.urlsafe_b64**code are too slow

2012-06-22 Thread Guido van Rossum
New submission from Guido van Rossum : 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: # Thi