Charles-François Natali added the comment:

> What/where do you mean exactly?

"""
187     def push (self, data):
188         sabs = self.ac_out_buffer_size
189         if len(data) > sabs:
190             for i in range(0, len(data), sabs):
191                 self.producer_fifo.append(data[i:i+sabs])
"""

len(data) is called twice

"""
228             # handle classic producer behavior
229             obs = self.ac_out_buffer_size
230             try:
231                 data = first[:obs]
232             except TypeError:
233                 data = first.more()
"""

Here, I think that len(first) <= self.ac_out_buffer_size, by
definition. So the slicing is actually just a copy (I realize that it
has the side effect of checking whether it's a buffer or a producer).

memoryview is also great to avoid copies when sending/receiving to a socket.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16787>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to