A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/039771.html below:

[Python-Dev] Deprecate the buffer object?

[Python-Dev] Deprecate the buffer object? [Python-Dev] Deprecate the buffer object?Troels Walsted Hansen troels at thule.no
Wed Oct 29 02:57:19 EST 2003
Raymond Hettinger wrote:

> At least the builtin buffer function should go away.
> Even if someone had a use for it, it would not make-up for all the time
> lost by all the other people trying to figure what it was good for.

I trust you will preserve the functionality though?

I have used the buffer() function to achieve great leaps in performance 
in applications which send data from a string buffer to a socket. 
Slicing kills performance in this scenario once buffer sizes get beyond 
a few 100 kB.

Below is example from an asyncore.dispatcher subclass. This code sends 
chunks with maximum size, without ever slicing the buffer.

     def handle_write(self):
         if self.buffer_offset:
             sent = self.send(buffer(self.buffer, self.buffer_offset))
         else:
             sent = self.send(self.buffer)
         self.buffer_offset += sent
         if self.buffer_offset == len(self.buffer):
             del self.buffer

Troels



More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4