This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients pitrou, serhiy.storchaka, vstinner
Date 2017-09-16.01:25:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1505525131.24.0.435085343779.issue30228@psf.upfronthosting.co.za>
In-reply-to
Content
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").close()' -o open_ref.json -v
$ ./python -m perf timeit --inherit=PYTHONPATH 'open("x.txt", "w").close()' -o open_patch.json -v
$ ./python -m perf compare_to open_ref.json open_patch.json 
Mean +- std dev: [open_ref] 18.6 us +- 0.2 us -> [open_patch] 18.2 us +- 0.2 us: 1.02x faster (-2%)


Microbenchmark using a btrfs filesystem mounted on NFS over wifi: not significant!

$ ./python -m perf timeit --inherit=PYTHONPATH 'open("nfs/x.txt", "w").close()' --append open_patch.json -v
$ ./python -m perf timeit --inherit=PYTHONPATH 'open("nfs/x.txt", "w").close()' --append open_patch.json -v
haypo@selma$ ./python -m perf compare_to open_ref.json open_patch.json  -v
Mean +- std dev: [open_ref] 17.8 ms +- 1.0 ms -> [open_patch] 17.8 ms +- 1.0 ms: 1.00x faster (-0%)
Not significant!

Note: open().close() is 1000x slower over NFS!

According to strace, on NFS, open() and close() are slow, but syscalls in the middle are as fast as syscalls on a local filesystem.

Well, it's hard to see a significant speedup, even on NFS. So I abandon my change.
History
Date User Action Args
2017-09-16 01:25:31vstinnersetrecipients: + vstinner, pitrou, serhiy.storchaka
2017-09-16 01:25:31vstinnersetmessageid: <1505525131.24.0.435085343779.issue30228@psf.upfronthosting.co.za>
2017-09-16 01:25:31vstinnerlinkissue30228 messages
2017-09-16 01:25:30vstinnercreate