Skip to content
  • Paul Sokolovsky's avatar
    py/objstr: Optimize string concatenation with empty string. · e2e66329
    Paul Sokolovsky authored
    In this, don't allocate copy, just return non-empty string. This helps
    with a standard pattern of buffering data in case of short reads:
    
        buf = b""
        while ...:
            s = f.read(...)
            buf += s
            ...
    
    For a typical case when single read returns all data needed, there won't
    be extra allocation. This optimization helps uasyncio.
    e2e66329