• da-woods's avatar
    Concatenate strings in place if possible (GH-3451) · 76043d6e
    da-woods authored
    Optimized inplace operations for str/unicode so that they're
    genuinely done in place if no-one else needs the object. This
    is what CPython tries to do (and string concatenation was
    a point where it significantly beat Cython at times).
    
    This only works if the types are known at compile time, so with
    unknown types CPython will still be faster in some cases.
    
    Note: Uses slightly odd-macro trickery - does modify the input argument too
    (although only in places where it shouldn't matter).
    76043d6e
ObjectHandling.c 92.3 KB