New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use writev() function in the io module #61855
Comments
Since issue bpo-12268 has been fixed, it looks like it became easier to modify the io to use the writev() function when available. For example, if FileIO.writelines() uses writev(), it can be used by TextIOWrapper.write() through BufferedWriter. The _io.TextIOWrapper.write() method stores encoded chunks of text into a list. It can calls buffer.writlines(pending) instead of buffer.write(b''.join(pending)). I expect less Python function calls and less system calls, and so better performances because both are expensive (especially I/O syscalls). See also issue bpo-15723. I don't know if/how readv() can be used to optimize I/O performances. |
I somehow doubt that the gain is worth the trouble, vectored disk I/O is not as interesting as vectored read/writes to a NIC. Actually, a quick search returned this link: Running the benchmark written by the Apache guys: Doesn't really surprise me. So I'm -1, since it's unlikely to yield any improvement, and will greatly complicate the code. |
Agreed with Charles-François, it probably won't make a difference in practice. |
I get similar Fedora 18 (Linux kernel 3.8.1), ext4 filesystem: $ rm -f writev.out; sync; sleep 5; ./copy_write
copy+write: 1s576530.
$ rm -f writev.out; sync; sleep 5; ./writev
writev: 1s686619. I agree to close the issue. At least this issue can be used later is someone else ask why Python is not using writev() ;-) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: