On Sat, 2007-09-29 at 15:22 +0000, [EMAIL PROTECTED] wrote:
> [...]
> def replacecycle(starttext):
>     p1= re.compile('(href=|HREF=)+(.*)(#)+(.*)( )+(.*)(">)+')
>     p2= re.compile('(name=")+(.*)( )+(.*)(">)+')
>     p3= re.compile('(href=|HREF=)+(.*)(#)+(.*)(\')+(.*)(">)+')
>     p4= re.compile('(name=")+(.*)(\')+(.*)(">)+')
>     p5= re.compile('(href=|HREF=)+(.*)(#)+(.*)(-)+(.*)(">)+')
>     p6= re.compile('(name=")+(.*)(-)+(.*)(">)+')
>     p7= re.compile('(href=|HREF=)+(.*)(#)+(.*)(<)+(.*)(">)+')
>     p8= re.compile('(name=")+(.*)(<)+(.*)(">)+')
>     p7= re.compile('(href=|HREF=")+(.*)(#)+(.*)(:)+(.*)(">)+')
>     p8= re.compile('(name=")+(.*)(:)+(.*)(">)+')
>     p9= re.compile('(href=|HREF=")+(.*)(#)+(.*)(\?)+(.*)(">)+')
>     p10= re.compile('(name=")+(.*)(\?)+(.*)(">)+')
>     p100= re.compile('(a name=)+(.*)(-)+(.*)(></a>)+')
> [...]

One obvious opportunity for optimization is to compile those re's only
once at the beginning of the program instead of every time
replacecycle() is called (which is inexplicably called 13 times for each
file).

-- 
Carsten Haese
http://informixdb.sourceforge.net


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to