[Python-3000] Making more effective use of slice objects in Py3k

Bob Ippolito bob at redivi.com
Thu Aug 31 05:56:03 CEST 2006

On 8/30/06, Fredrik Lundh <fredrik at pythonware.com> wrote:
> Fredrik Lundh wrote:
> > not necessarily, but there are lots of issues involved when doing
> > high-performance XML stuff, and I'm not sure views would help quite as
> > much as one might think.
> >
> > (writing and tuning cET was a great way to learn that not everything
> > that you think you know about C performance applies to C code running
> > inside the Python interpreter...)
> and also based on the cET (and NFS) experiences, it wouldn't surprise me
> if a naive 32-bit text string implementation will, on average, slow things down
> *more* than any string view implementation can speed things up again...
> (in other words, I'm convinced that we need a polymorphic string type.  I'm not
> so sure we need views, but if we have the former, we can use that mechanism to
> support the latter)

+1 for polymorphic strings.

This would give us the best of both worlds: compact representations
for ASCII and Latin-1, full 32-bit text when needed, and the
possibility to implement further optimizations when necessary. It
could add a bit of complexity and/or a massive speed penalty
(depending on how naive the implementation is) around character
operations though.

For implementation ideas, Apple's CoreFoundation has a mature
implementation of polymorphic strings in C (which is the basis for
their NSString type in Objective-C), and there's a cross-platform
subset of it available as CF-Lite:


More information about the Python-3000 mailing list