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 pitrou
Recipients gvanrossum, janssen, jimjjewett, loewis, mgiuca, orsenthil, pitrou, thomaspinckney3
Date 2008-08-14.13:07:23
SpamBayes Score 0.0051082834
Marked as misclassified No
Message-id <1218719260.48a42e1c58d2c@imp.free.fr>
In-reply-to <1218716331.89.0.261736879306.issue3300@psf.upfronthosting.co.za>
Content
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.
History
Date User Action Args
2008-08-14 13:07:24pitrousetrecipients: + pitrou, gvanrossum, loewis, jimjjewett, janssen, orsenthil, thomaspinckney3, mgiuca
2008-08-14 13:07:23pitroulinkissue3300 messages
2008-08-14 13:07:23pitroucreate