yeting li <l...@ios.ac.cn> added the comment:
For a regex has polynomial worst-case complexity, limiting the maximum input length is indeed a very effective method. As shown below, as the input length becomes smaller, the matching time becomes significantly smaller. header = '' + ',' * (10 ** 4) 1.617s header = '' + ',' * (10 ** 3) 0.014s header = '' + ',' * (10 ** 2) 0.00017s ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43075> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com