Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 30181:7356e6b1f5b8
util: increase filechunkiter size to 128k
util.filechunkiter has been using a chunk size of 64k for more than 10 years,
also in years where Moore's law still was a law. It is probably ok to bump it
now and perhaps get a slight win in some cases.
Also, largefiles have been using 128k for a long time. Specifying that size
multiple times (or forgetting to do it) seems a bit stupid. Decreasing it to
64k also seems unfortunate.
Thus, we will set the default chunksize to 128k and use the default everywhere.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Fri, 14 Oct 2016 01:53:15 +0200 |
parents | 9b230a8e6008 |
children | 6a8aff737a17 b496a464399c |
comparison
equal
deleted
inserted
replaced
30180:736f92c44656 | 30181:7356e6b1f5b8 |
---|---|
1682 self._chunkoffset += left | 1682 self._chunkoffset += left |
1683 left -= chunkremaining | 1683 left -= chunkremaining |
1684 | 1684 |
1685 return ''.join(buf) | 1685 return ''.join(buf) |
1686 | 1686 |
1687 def filechunkiter(f, size=65536, limit=None): | 1687 def filechunkiter(f, size=131072, limit=None): |
1688 """Create a generator that produces the data in the file size | 1688 """Create a generator that produces the data in the file size |
1689 (default 65536) bytes at a time, up to optional limit (default is | 1689 (default 131072) bytes at a time, up to optional limit (default is |
1690 to read all data). Chunks may be less than size bytes if the | 1690 to read all data). Chunks may be less than size bytes if the |
1691 chunk is the last chunk in the file, or the file is a socket or | 1691 chunk is the last chunk in the file, or the file is a socket or |
1692 some other type of file that sometimes reads less data than is | 1692 some other type of file that sometimes reads less data than is |
1693 requested.""" | 1693 requested.""" |
1694 assert size >= 0 | 1694 assert size >= 0 |