Re: String concatenation vs. string formatting



On Sat, Jul 9, 2011 at 12:16 AM, Chris Angelico <rosuav@xxxxxxxxx> wrote:
Has the same optimization been implemented for Unicode? The page
doesn't mention Python 3 at all, and I would guess that the realloc
optimization would work fine for both types of string.

Seems to be implemented for strs in 3.2, but not unicode in 2.7.
.



Relevant Pages

  • Re: C Slower than Python?
    ... However it is an important optimization; ... You don't keep track of string lengths. ... Python is actually doing in your test. ... I suppose these same routines could be used in a C library to speed things ...
    (comp.lang.c)
  • Re: Flexible string representation, unicode, typography, ...
    ... have different internal representations even though their content is ... so it's an unsafe optimization to automatically treat them as ... occurs while a string is being built. ... E.g. if you have Python code like ...
    (comp.lang.python)
  • Re: sum and strings
    ... Python should insist that addition be symmetric an transitive, ... Martelli's initial implementation included the string ... optimization so that a list with a string as its first element ...
    (comp.lang.python)
  • Re: String Concatenation O(n^2) (was: Re: Explaining Implementing a Binary Search Tree.)
    ... An optimization was introduced where, ... string being concatenated to is not referred to anywhere else, ... but only with a version of Python where this optimization exists and only ... if the code can manage to trigger it. ...
    (comp.lang.python)
  • TOC of Python Cookbook now online (was Re: author index for Python Cookbook 2?)
    ... Processing a String One Character at a Time ... Finding a File on the Python Search Path ... Constructing Lists with List Comprehensions ... Looping over Items and Their Indices in a Sequence ...
    (comp.lang.python)