◐ Shell
clean mode source ↗

gh-139871: Optimize small takes in bytearray.take_bytes by cmaloney · Pull Request #141741 · python/cpython

When less than half the buffer is taken just copy that small part out
rather than doing a big alloc + memmove + big shrink.

encukou

vstinner

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>

StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request

Dec 6, 2025
…GH-141741)

When less than half the buffer is taken just copy that small part out
rather than doing a big alloc + memmove + big shrink.

ashm-dev pushed a commit to ashm-dev/cpython that referenced this pull request

Dec 8, 2025
…GH-141741)

When less than half the buffer is taken just copy that small part out
rather than doing a big alloc + memmove + big shrink.