On Tue, Sep 4, 2012 at 11:54 AM, Roy Smith <r...@panix.com> wrote: > I'm wondering if it might be faster to start at the ends of the strings > instead of at the beginning?
> I'm also not sure how this work with all the possible UCS/UTF encodings. > With some of them, you may get the encoding semantics wrong if you don't > start from the front. No problem there; Python uses only fixed-width encodings. Also, any canonical encoding can be safely compared byte-for-byte; two identical Unicode strings will be bit-wise identical in (say) UTF-8. There's issues of cache locality and such that quite possibly mean it's not going to be faster overall, but it wouldn't be difficult to tweak the Python sources, recompile, and run some tests. I'm sure python-dev or python-list will be most happy to discuss some benchmark figures! ChrisA -- http://mail.python.org/mailman/listinfo/python-list