[issue30228] Open a file in text mode requires too many syscalls

2017-09-15 Thread STINNER Victor
Changes by STINNER Victor : -- resolution: rejected -> fixed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue30228] Open a file in text mode requires too many syscalls

2017-09-15 Thread STINNER Victor
Changes by STINNER Victor : -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-

[issue30228] Open a file in text mode requires too many syscalls

2017-09-15 Thread STINNER Victor
STINNER Victor added the comment: Microbenchmark on Fedora 26 for https://github.com/python/cpython/pull/1385 Working directly uses ext4, the filesystem operations are likely cached in memory, so syscalls should be very fast. $ ./python -m perf timeit --inherit=PYTHONPATH 'open("x.txt", "w").c

[issue30228] Open a file in text mode requires too many syscalls

2017-05-03 Thread STINNER Victor
STINNER Victor added the comment: > Or provide a function similar to the RAW_TELL macro but just checking if the > current position is 0. I will try to implement such function and use it in textio.c. -- ___ Python tracker

[issue30228] Open a file in text mode requires too many syscalls

2017-05-03 Thread STINNER Victor
STINNER Victor added the comment: > You could call buffer.seek(0, SEEK_CUR) rather than buffer.tell() for > avoiding a system call for readable stream. But this looks as a shamanism too. Note: Buffered.seek(0, SEEK_CUR) only has a fast-path for readable file: it cannot be used to optimize open

[issue30228] Open a file in text mode requires too many syscalls

2017-05-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I don't like PR 1385. abs_pos is a private attribute used only in _io._Buffered.seek() for readable streams when whence is SEEK_SET or SEEK_CUR. There is no guarantee that it contains relevant value for non-readable stream. You could call buffer.seek(0, SEEK

[issue30228] Open a file in text mode requires too many syscalls

2017-05-02 Thread STINNER Victor
STINNER Victor added the comment: New changeset 999707373630ce090300c3c542066f493b12faa0 by Victor Stinner in branch 'master': bpo-30228: FileIO seek() and tell() set seekable (#1384) https://github.com/python/cpython/commit/999707373630ce090300c3c542066f493b12faa0 -- ___

[issue30228] Open a file in text mode requires too many syscalls

2017-05-02 Thread STINNER Victor
Changes by STINNER Victor : -- components: +IO ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue30228] Open a file in text mode requires too many syscalls

2017-05-02 Thread STINNER Victor
Changes by STINNER Victor : -- pull_requests: +1492 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue30228] Open a file in text mode requires too many syscalls

2017-05-02 Thread STINNER Victor
Changes by STINNER Victor : -- pull_requests: +1491 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mai

[issue30228] Open a file in text mode requires too many syscalls

2017-05-02 Thread STINNER Victor
New submission from STINNER Victor: Example: with open("x", "w", encoding="utf-8") as fp: fp.write("HERE") fp.close() syscalls: 14249 open("x", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 3 14249 fstat(3, {st_mode=S_IFREG|0664, st_size=0, ...}) = 0 14249 ioctl(3, TCGETS, 0x7fff07d43330