[ python-Bugs-1285086 ] urllib.quote is too slow
SourceForge.net
noreply at sourceforge.net
Fri Sep 9 04:30:33 CEST 2005
Bugs item #1285086, was opened at 2005-09-08 12:37
Message generated for change (Comment added) made by tseaver
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1285086&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Tres Seaver (tseaver)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib.quote is too slow
Initial Comment:
'urllib.quote' delegates to '_fast_quote' for the common
case that the user has passed no 'safe' argument. However,
'_fast_quote' isn't really very fast, especially for
the case that
it doesn't need to quote anything.
Zope (and presumably other web frameworks) can end up
calling 'quote' dozens, hundreds, even thousands of times
to render a page, which makes this a potentially big win
for them.
I will attach a speed test script which demonstrates the
speed penalty, along with a patch which implements the
speedup.
----------------------------------------------------------------------
>Comment By: Tres Seaver (tseaver)
Date: 2005-09-08 22:30
Message:
Logged In: YES
user_id=127625
I'm attaching a patch against 2.4's version
----------------------------------------------------------------------
Comment By: Jeff Epler (jepler)
Date: 2005-09-08 21:01
Message:
Logged In: YES
user_id=2772
Tested on Python 2.4.0. The patch fails on the first chunk
because the list of imports don't match.
The urllib_fast_quote_speed_test.py doesn't run once urllib
has been patched.
I reverted the patch to urllib.py and re-ran. I got
"faster" values from 0.758 to 0.964.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1285086&group_id=5470
More information about the Python-bugs-list
mailing list