Tim Peters <t...@python.org> added the comment:
Dennis, I think that's expected, right? Two-way on its own can exploit nothing about individual characters - it only preprocesses the needle to break the possibility for quadratic-time behavior due to periods in the needle. It sounds like you switched the current code's Sunday-ish approach to a more Boyer-Moore-ish approach. That probably hurt, and especially for shorter needles (where Sunday can yield a maximum shift of len(needle)+1, not len(needle) - the "+1" is more significant the smaller len(needle)). Sunday gave 3 variants of his basic algorithm, and in his tests they were all faster than Boyer-Moore, and more so the shorter the needle. Just FYI, here's a scanned PDF of his paper: https://csclub.uwaterloo.ca/~pbarfuss/p132-sunday.pdf ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41972> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com