On 03/06/2011 03:58, Chris Torek wrote:
-------------------------------------------------
This is a bit surprising, since both "s1 in s2" and re.search()
could use a Boyer-Moore-based algorithm for a sufficiently-long
fixed string, and the time required should be proportional to that
needed to set up the skip table. The re.compile() gets to re-use
the table every time.
Is that true? My immediate thought is that Boyer-Moore would quickly give
the number of characters to skip, but skipping them would be slow because
UTF8 encoded characters are variable sized, and the string would have to be
walked anyway.
Or am I misunderstanding something.
Ian
--
http://mail.python.org/mailman/listinfo/python-list