New submission from Pieter Eendebak <pieter.eende...@gmail.com>:
The bytearray_repeat and bytearray_irepeat are inefficient for small arrays and a high number of repeats. This can be improved by using the same approach is in the corresponding bytes_repeat method. Microbenchmark: python -m pyperf timeit "b=bytearray([1,2,])*100" Mean +- std dev: [base100] 479 ns +- 29 ns -> [patch100] 274 ns +- 18 ns: 1.75x faster python -m pyperf timeit "b=bytearray([1,2,])*1000" Mean +- std dev: [base1000] 2.58 us +- 0.18 us -> [patch1000] 399 ns +- 26 ns: 6.46x faster ---------- components: Interpreter Core messages: 415077 nosy: pieter.eendebak priority: normal severity: normal status: open title: Improve performance of bytes_repeat type: performance versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue47005> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com