This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pieter.eendebak
Recipients pieter.eendebak
Date 2022-03-13.19:01:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1647198086.65.0.133480575826.issue47005@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2022-03-13 19:01:26pieter.eendebaksetrecipients: + pieter.eendebak
2022-03-13 19:01:26pieter.eendebaksetmessageid: <1647198086.65.0.133480575826.issue47005@roundup.psfhosted.org>
2022-03-13 19:01:26pieter.eendebaklinkissue47005 messages
2022-03-13 19:01:26pieter.eendebakcreate