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/2012-July/120986.html below:

[Python-Dev] io.BytesIO slower than monkey-patching io.RawIOBase

[Python-Dev] io.BytesIO slower than monkey-patching io.RawIOBase [Python-Dev] io.BytesIO slower than monkey-patching io.RawIOBaseAntoine Pitrou solipsis at pitrou.net
Tue Jul 17 10:35:02 CEST 2012
On Tue, 17 Jul 2012 06:34:14 +0300
Eli Bendersky <eliben at gmail.com> wrote:
> 
> Is there any reason for this to be so? What does BytesIO give us that the
> second approach does not (I tried adding more methods to the patched
> RawIOBase to make it more functional, like seekable() and tell(), and it
> doesn't affect performance)?

Well, try implementing non-trivial methods such as readline() or
seek(), and writing in the middle rather than at the end. 

As Nick said, we could implement the same optimization as in StringIO,
i.e. only materialize the buffer when necessary.

Regards

Antoine.


-- 
Software development and contracting: http://pro.pitrou.net


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