Mercurial > hg
comparison tests/test-bookmarks-current.t @ 30418:1156ec81f709
util: improve iterfile so it chooses code path wisely
We have performance concerns on "iterfile" as it is 4X slower on normal
files. While modern systems have the nice property that reading a "fast"
(on-disk) file cannot be interrupted and should be made use of.
This patch dumps the related knowledge in comments. And "iterfile" chooses
code paths wisely:
1. If it's CPython 3, or PyPY, use the fast path.
2. If fp is a normal file, use the fast path.
3. If fp is not a normal file and CPython version >= 2.7.4, use the same
workaround (4x slower) as before.
4. If fp is not a normal file and CPython version < 2.7.4, use another
workaround (2x slower but may block longer then necessary) which
basically re-invents the buffer + readline logic in Python.
This will give us good confidence on both correctness and performance
dealing with EINTR in iterfile(fp) for all known supported Python versions.
author | Jun Wu <quark@fb.com> |
---|---|
date | Tue, 15 Nov 2016 20:25:51 +0000 |
parents | 2e1bceeea520 |
children | 337443f09fc8 |
comparison
equal
deleted
inserted
replaced
30417:854190becacb | 30418:1156ec81f709 |
---|