I don&#x27;t have a reference, but bytearray concatenation with some more bytes is amortized O(1) w.r.t. original bytearray size, but for bytes it is O(n) where n is the length of the byte string, because bytes are immutable and they are copied to a new byte string on each concatenation.<p>In python2 strings&#x2F;bytes are also immutable but concatenation is O(1) w.r.t. original string.  
Not sure about internal implementation differences.<p>so basically whenever you see code like:<p><pre><code>    some_bstr = b&#x27;&#x27;
    for something in get_something():
        some_bstr += something
</code></pre>
And if you have to do it this way, make sure that some_bstr is a bytearray or make it a list that you later join.