[issue3300] urllib.quote and unquote - Unicode issues

Antoine Pitrou report at bugs.python.org
Thu Aug 14 15:07:24 CEST 2008


Antoine Pitrou <pitrou at free.fr> added the comment:

Hello Matt,

> OK I implemented the defaultdict solution. I got curious so ran some
> rough speed tests, using the following code.
>
> import random, urllib.parse
> for i in range(0, 100000):
>     str = ''.join(chr(random.randint(0, 0x10ffff)) for _ in range(50))
>     quoted = urllib.parse.quote(str)

I think if you move the line defining "str" out of the loop, relative timings
should change quite a bit. Chances are that the random functions are not very
fast, since they are written in pure Python.
Or you can create an inner loop around the call to quote(), for example to
repeat it 100 times.

cheers

Antoine.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3300>
_______________________________________


More information about the Python-bugs-list mailing list