[issue1569291] Speed-up in array_repeat()

Alexander Belopolsky report at bugs.python.org
Mon Mar 24 20:33:40 CET 2008


Alexander Belopolsky <belopolsky at users.sourceforge.net> 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 <report at bugs.python.org>
<http://bugs.python.org/issue1569291>
_____________________________________


More information about the Python-bugs-list mailing list