[New-bugs-announce] [issue12807] Optimizations for {bytearray, bytes, unicode}.strip()

John O'Connor report at bugs.python.org
Mon Aug 22 04:59:01 CEST 2011

New submission from John O'Connor <tehjcon at gmail.com>:

bytearray() is using a less efficient implementation of split() than its similar friends bytes and unicode.

I added a couple extra checks to return early in {bytes,unicode} split().
 - if length is 0
 - if left strip removed all bytes

Looking at just how similar these 3 implementations are I feel that we could also unify/generalize them into one generic helper implementation and leave the object marshaling up to the type specific methods.

components: Interpreter Core
files: strip_perf.patch
keywords: patch
messages: 142660
nosy: benjamin.peterson, ezio.melotti, haypo, jcon, pitrou
priority: normal
severity: normal
status: open
title: Optimizations for {bytearray,bytes,unicode}.strip()
type: performance
versions: Python 3.3
Added file: http://bugs.python.org/file22982/strip_perf.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list