Gurmeet Singh added the comment:

Please consider following before making a decision:

>> io.FileIO does not implements single OS system call on read() - instead
>> reads a file until EOF i.e. ignores the arguments supplied to read() 

>Your experiments show otherwise, the argument supplied to read() is >observed: 
>if you call read(1024), at most 1024 bytes are returned, etc.

>It's only if you call read() without an argument that the file is being >read 
>until EOF.

I said this because I saw the following in the docs:
>class io.RawIOBase 
>read(n=-1) 
>Read up to n bytes from the object and return them. As a convenience, >if n is 
>unspecified or -1, readall() is called. Otherwise, only one >system call is 
>ever made. Fewer than n bytes may be returned if the >operating system call 
>returns fewer than n bytes.

If only one system call is being made, then I think that 
fl.read(256) and fl.read(70934549) should take same amount of time to complete 
- assuming disk I/O is the time consuming factor in this operation (as compared 
to memory processing).

I am only saying that instead of one system call being made - the whole size 
specified by read is being read (by multiple system calls - as it appears to 
me). 

Please tell me if I am wrong here.

----------

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

Reply via email to