[Zope-dev] Re: Speed win in Python's urllib.quote

Tres Seaver tseaver at palladion.com
Mon Sep 12 08:52:44 EDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tres Seaver wrote:
> While profiling a page full of dynamically-generated links, I was
> interested to see Python's 'urllib._fast_quote' show up quite high in
> the total time list.  After looking at it, I have found a pretty huge
> speed win available, posted to Python's SF tracker as bug #1285086:
> 
> 
> https://sourceforge.net/tracker/index.php?func=detail&aid=1285086&group_id=5470&atid=105470
> 
> Zope makes *heavy* use of urllib.quote (quoting each element of the path
> in 'absolute_url', for instance), which makes it a particularly
> interesting speedup for us.

On further consideration (and after some more profiling), I would
actually prefer inlining the speedup code directly into
OFS.Traversable.Traversable, to remove the extra function call as well
as to avoid the gnarliness of monkey-patching Python.  An alternative
would be to call 'quote' only once (for the completed string), rather
than repeatedly (for each path element).

The SF traffic for the bug is interesing:  the fix checked in is an
improvement, but not nearly as big a win for the case (very common in
English-language Zope sites, anyway) where the path elements are already
URL safe.


Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDJXob+gerLs4ltQ4RAlgbAKCEP2yIxCetpiY9SW2+BDr5PJFfTACgoS9H
c8X+2m06eCpNhZTcKpsunv0=
=u0g7
-----END PGP SIGNATURE-----



More information about the Zope-Dev mailing list