bundle2: avoid unbound read when seeking
Currently, seekableunbundlepart.seek() will perform a read() during
seek operations. This will allocate a buffer to hold the raw data
over the seek distance. This can lead to very large allocations
and cause performance to suffer.
We change the code to perform read(32768) in a loop to avoid
potentially large allocations.
`hg perfbundleread` on an uncompressed Firefox bundle reveals
a performance impact:
! bundle2 iterparts()
! wall 2.992605 comb 2.990000 user 2.260000 sys 0.730000 (best of 4)
! bundle2 iterparts() seekable
! wall 3.863810 comb 3.860000 user 3.000000 sys 0.860000 (best of 3)
! bundle2 part seek()
! wall 6.213387 comb 6.200000 user 3.350000 sys 2.850000 (best of 3)
! wall 3.820347 comb 3.810000 user 2.980000 sys 0.830000 (best of 3)
Since seekable bundle parts are (only) used by bundlerepo, this /may/
speed up initial loading of bundle-based repos. But any improvement
will likely only be noticed on very large bundles.
Differential Revision: https://phab.mercurial-scm.org/D1394
test-addremove.t
test-ancestor.py
test-backwards-remove.t
test-bheads.t
test-bisect2.t
test-bookmarks-merge.t
test-bookmarks-strip.t
test-branch-tag-confict.t
test-casecollision.t
test-changelog-exec.t
test-check-commit.t
test-check-execute.t
test-check-module-imports.t
test-check-pyflakes.t
test-check-pylint.t
test-check-shbang.t
test-commit-unresolved.t
test-contrib-check-code.t
test-contrib-check-commit.t
test-debugrename.t
test-diff-copy-depth.t
test-diff-hashes.t
test-diff-issue2761.t
test-diff-newlines.t
test-diff-reverse.t
test-diff-subdir.t
test-dirstate-nonnormalset.t
test-doctest.py
test-double-merge.t
test-duplicateoptions.py
test-empty-dir.t
test-empty-file.t
test-empty.t
test-encoding-func.py
test-excessive-merge.t
test-hghave.t
test-imports-checker.t
test-issue1089.t
test-issue1877.t
test-issue1993.t
test-issue612.t
test-issue619.t
test-issue672.t
test-issue842.t
test-journal-exists.t
test-locate.t
test-lrucachedict.py
test-manifest.py
test-match.py
test-merge-default.t
test-merge2.t
test-merge4.t
test-merge5.t
test-permissions.t
test-push-checkheads-pruned-B1.t
test-push-checkheads-pruned-B6.t
test-push-checkheads-pruned-B7.t
test-push-checkheads-superceed-A1.t
test-push-checkheads-superceed-A4.t
test-push-checkheads-superceed-A5.t
test-push-checkheads-superceed-A8.t
test-push-checkheads-unpushed-D1.t
test-push-checkheads-unpushed-D6.t
test-push-checkheads-unpushed-D7.t
test-rename-merge1.t
test-rename.t
test-revlog-packentry.t
test-run-tests.py
test-show-stack.t
test-status-terse.t
test-terse-status.t
test-unified-test.t
test-update-issue1456.t
test-update-reverse.t
test-xdg.t