Whereas the same (catenation) algorithm using char strings is also very much faster and roughly linear.
It looks like the bytes catenation switches to a very poor algorithm when the string size gets around the 1 MB Mark.
I like the Numpy 2-D array approach conceptually though there are a couple of hoops to jump through to get from Numpy int array to bytes vector.
... to an ever increasing bytes string....
I’m am curious as to the difference between char and bytes strings in this regard.
It looks like the bytes catenation switches to a very poor algorithm when the string size gets around the 1 MB Mark.
I like the Numpy 2-D array approach conceptually though there are a couple of hoops to jump through to get from Numpy int array to bytes vector.
Quote:indeed comes from the repeated concatenation of a single pixel to a bytes string. Here is my faster code.
... to an ever increasing bytes string....
I’m am curious as to the difference between char and bytes strings in this regard.