[issue21638] Seeking to EOF is too inefficient!

Linlin Yan report at bugs.python.org
Tue Jun 3 03:35:27 CEST 2014


Linlin Yan added the comment:

I agree that Python 2 should use fopen / fread rather than directly read().
But you may misunderstand this. The 'strace' tool reports Linux system
calls, including read() rather than fread(), and I guess that read() should
be finally called in fread() implementation.

What I mean is that Python 2's seek(0, 2) does not use fseek(0, SEEK_END),
but fseek(somewhere, SEEK_SET) and fread(rest-bytes) instead, which is too
inefficient in some kind of storage.

By the way, Python 3 does not behavior like this.

On Tue, Jun 3, 2014 at 4:35 AM, STINNER Victor <report at bugs.python.org>
wrote:

>
> STINNER Victor added the comment:
>
> I don't think that Python calls directly read(). Python 2 uses fopen /
> fread.
>
> Python 3 doesn't use buffered files, but call open / read directly.
>
> ----------
> nosy: +haypo, neologix
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue21638>
> _______________________________________
>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21638>
_______________________________________


More information about the Python-bugs-list mailing list