Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: Attached patch (issue1569291.diff) reimplements the optimization by following Objects/stringobject.c logic as Raymond suggested.
I see two remaining issues which in my view should be addressed separately: 1. There is no check for overflow after the multiplication computing the size of the resulting array. Note that while newarrayobject checks that size*itemsize does not overflow internally, there is no such check for Py_SIZE(a) * n. A decision needs to be made whether Overflow or NoMemory error should be raised because currently string_repeat and newarrayobject treat overflow differently. 2. See msg64429 above. I think both string and (patched) array codes can be simplified. ---------- keywords: +patch type: -> performance Added file: http://bugs.python.org/file9841/issue1569291.diff _____________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1569291> _____________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com