sapling/contrib
Gregory Szorc 2f77487f6f bundle2: don't use seekable bundle2 parts by default (issue5691)
The last commit removed the last use of the bundle2 part seek() API
in the generic bundle2 part iteration code. This means we can now
switch to using unseekable bundle2 parts by default and have the
special consumers that actually need the behavior request it.

This commit changes unbundle20.iterparts() to expose non-seekable
unbundlepart instances by default. If seekable parts are needed,
callers can pass "seekable=True." The bundlerepo class needs
seekable parts, so it does this.

The interrupt handler is also changed to use a regular unbundlepart.
So, by default, all consumers except bundlerepo will see unseekable
parts.

Because the behavior of the iterparts() benchmark changed, we add
a variation to test seekable parts vs unseekable parts. And because
parts no longer have seek() unless "seekable=True," we update the
"part seek" benchmark.

Speaking of benchmarks, this change has the following impact to
`hg perfbundleread` on an uncompressed bundle of the Firefox repo
(6,070,036,163 bytes):

! read(8k)
! wall 0.722709 comb 0.720000 user 0.150000 sys 0.570000 (best of 14)
! read(16k)
! wall 0.602208 comb 0.590000 user 0.080000 sys 0.510000 (best of 17)
! read(32k)
! wall 0.554018 comb 0.560000 user 0.050000 sys 0.510000 (best of 18)
! read(128k)
! wall 0.520086 comb 0.530000 user 0.020000 sys 0.510000 (best of 20)
! bundle2 forwardchunks()
! wall 2.996329 comb 3.000000 user 2.300000 sys 0.700000 (best of 4)
! bundle2 iterparts()
! wall 8.070791 comb 8.060000 user 7.180000 sys 0.880000 (best of 3)
! wall 6.983756 comb 6.980000 user 6.220000 sys 0.760000 (best of 3)
! bundle2 iterparts() seekable
! wall 8.132131 comb 8.110000 user 7.160000 sys 0.950000 (best of 3)
! bundle2 part seek()
! wall 10.370142 comb 10.350000 user 7.430000 sys 2.920000 (best of 3)
! wall 10.860942 comb 10.840000 user 7.790000 sys 3.050000 (best of 3)
! bundle2 part read(8k)
! wall 8.599892 comb 8.580000 user 7.720000 sys 0.860000 (best of 3)
! wall 7.258035 comb 7.260000 user 6.470000 sys 0.790000 (best of 3)
! bundle2 part read(16k)
! wall 8.265361 comb 8.250000 user 7.360000 sys 0.890000 (best of 3)
! wall 7.099891 comb 7.080000 user 6.310000 sys 0.770000 (best of 3)
! bundle2 part read(32k)
! wall 8.290308 comb 8.280000 user 7.330000 sys 0.950000 (best of 3)
! wall 6.964685 comb 6.950000 user 6.130000 sys 0.820000 (best of 3)
! bundle2 part read(128k)
! wall 8.204900 comb 8.150000 user 7.210000 sys 0.940000 (best of 3)
! wall 6.852867 comb 6.850000 user 6.060000 sys 0.790000 (best of 3)

The significant speedup is due to not incurring the overhead to track
payload offset data. Of course, this overhead is proportional to
bundle2 part size. So a multiple gigabyte changegroup part is on the
extreme side of the spectrum for real-world impact.

In addition to the CPU efficiency wins, not tracking offset data
also means not using memory to hold that data. Using a bundle based on
the example BSD repository in issue 5691, this change has a drastic
impact to memory usage during `hg unbundle` (`hg clone` would behave
similarly). Before, memory usage incrementally increased for the
duration of bundle processing. In other words, as we advanced through
the changegroup and bundle2 part, we kept allocating more memory to
hold offset data. After this change, we still increase memory during
changegroup application. But the rate of increase is significantly
slower. (A bulk of the remaining gradual increase appears to be the
storing of revlog sizes in the transaction object to facilitate
rollback.)

The RSS at the end of filelog application is as follows:

Before: ~752 MB
After:  ~567 MB

So, we were storing ~185 MB of offset data that we never even used.
Talk about wasteful!

.. api::

   bundle2 parts are no longer seekable by default.

.. perf::

   bundle2 read I/O throughput significantly increased.

.. perf::

   Significant memory use reductions when reading from bundle2 bundles.

   On the BSD repository, peak RSS during changegroup application
   decreased by ~185 MB from ~752 MB to ~567 MB.

Differential Revision: https://phab.mercurial-scm.org/D1390
2017-11-13 21:10:37 -08:00
..
benchmarks perf: add historical support of ui.load() 2016-12-15 12:17:08 +01:00
chg chg: remove outdated rule to start test server 2017-10-12 22:21:14 +09:00
debian build: "make deb" failed when the base path contained spaces 2017-10-11 01:47:00 +02:00
docker docker: try to follow the best practices for writing Dockerfiles 2017-10-01 01:02:22 +02:00
hgsh backout of e4cb9628354c 2011-01-27 11:15:08 +01:00
macosx packaging: update book URL in Mac and Windows READMEs 2017-10-20 13:54:51 -05:00
plan9 urls: bulk-change primary website URLs 2015-09-30 15:43:49 -05:00
python-zstandard zstd: vendor python-zstandard 0.8.1 2017-04-08 14:33:20 -07:00
vagrant vagrant: update to official Debian 8.1 base box 2015-09-02 11:52:24 -05:00
vim spelling: fixes of non-dictionary words 2016-10-17 23:16:55 +02:00
win32 packaging: update book URL in Mac and Windows READMEs 2017-10-20 13:54:51 -05:00
wix help: adding a topic on flags 2017-10-30 20:35:30 -07:00
all-revsets.txt spelling: fixes of non-dictionary words 2016-10-17 23:16:55 +02:00
asv.conf.json perf: add asv benchmarks 2016-09-29 10:16:34 +02:00
base-revsets.txt contrib: introduce an all-revsets.txt file 2015-06-16 22:15:30 -07:00
bash_completion bashcompletion: allow skipping completion for 'hg status' 2016-09-26 10:47:37 +02:00
bdiff-torture.py mpatch: proxy through mdiff module 2017-04-26 22:05:59 +09:00
build-linux-wheels.sh contrib: make build-linux-wheels.sh executable 2017-07-19 13:45:06 -04:00
builddeb build: "make deb" failed when the base path contained spaces 2017-10-11 01:47:00 +02:00
buildrpm build: build deb/rpm independently on config/extensions in the host system 2017-10-17 22:46:08 +02:00
casesmash.py casesmash: use absolute_import 2016-03-06 02:25:50 +05:30
check-code.py check-code: grep's context flags don't need an extra space before number 2017-11-18 13:00:47 +08:00
check-commit contrib: fix check-commit to not reject commits from hg sign and hg tag 2017-01-18 23:34:35 -05:00
check-config.py check-config: mention the file and line of the error 2017-07-18 06:27:36 -07:00
check-py3-compat.py check: check modules in hgdemandimport 2017-05-21 13:44:26 -07:00
clang-format-blacklist parsers: allow clang-format here 2017-10-16 14:53:57 -04:00
debugcmdserver.py debugcmdserver: use absolute_import and print_function 2016-03-06 03:06:09 +05:30
debugshell.py manifest: remove last uses of repo.manifest 2016-11-10 02:13:19 -08:00
dirstatenonnormalcheck.py dirstate: move nonnormal and otherparent sets to dirstatemap 2017-10-05 11:34:41 -07:00
dockerdeb dockerdeb: pass the rest of the args to the builder script 2016-04-23 12:47:57 -07:00
dockerlib.sh docker: pass proxy arguments to docker process 2017-07-27 13:44:15 +02:00
dockerrpm docker: pass proxy arguments to docker process 2017-07-27 13:44:15 +02:00
dumprevlog py3: make contrib/dumprevlog use print_function 2016-05-13 02:16:32 +05:30
editmerge editmerge: dequote other use of $ED 2015-10-19 21:36:12 -07:00
editmergeps.bat contrib: run editmergeps.ps1 from the same location as editmergeps.bat 2017-05-30 05:56:48 -07:00
editmergeps.ps1 contrib: remove unnecessary debug output from editmergeps.ps1 2017-05-30 06:22:14 -07:00
fixpax.py fixpax: use absolute_import and print_function 2016-03-06 03:10:17 +05:30
genosxversion.py osx: new script for generating OS X package versions 2017-07-24 20:38:09 -04:00
hg-ssh contrib: update hg-ssh to conform with import style checks 2017-08-22 14:11:48 -04:00
hg-test-mode.el hg-test-mode: make exit code highlight work again 2014-08-12 12:53:23 -05:00
hgclient.py test-commandserver: handle cStringIO.StringIO/io.StringIO divergence 2016-04-06 20:34:34 +00:00
hgk hgk: display committer name when set by hg-git 2015-04-03 22:44:25 +02:00
hgperf dispatch: move initialization of sys.std* files 2017-10-02 07:18:24 +01:00
hgweb.fcgi mq: add a warning about uncommitted changes for qfinish 2011-11-10 15:40:34 -06:00
hgweb.wsgi urls: bulk-change primary website URLs 2015-09-30 15:43:49 -05:00
import-checker.py tests: disable lints on mercurial/thirdparty 2017-10-01 03:24:19 -07:00
linux-wheel-centos5-blacklist packaging: add make target for linux wheels 2017-04-25 16:50:01 +02:00
logo-droplets.svg logo: clean up source file with scour 2010-04-05 14:33:41 -05:00
Makefile.python contrib: disable SSLv3_method() to build old Python with recent libssl 2015-11-07 16:31:04 +09:00
memory.py atexit: switch to home-grown implementation 2017-04-11 14:54:12 -07:00
mercurial.el en-us: penalize 2012-08-17 13:58:19 -07:00
mercurial.spec rpms: add chg 2017-07-27 16:09:26 +02:00
mq.el Remove FSF mailing address from GPL headers 2012-01-06 16:27:13 +01:00
packagelib.sh build: build deb/rpm independently on config/extensions in the host system 2017-10-17 22:46:08 +02:00
perf.py bundle2: don't use seekable bundle2 parts by default (issue5691) 2017-11-13 21:10:37 -08:00
phabricator.py phabricator: add a config to use curl for communication 2017-09-01 12:13:17 -07:00
pylintrc codingstyle: remove trailing spaces in various text files 2013-04-17 03:40:18 +02:00
python3-ratchet.py contrib: add a ratchet for tests in Python 3 2017-06-15 11:00:29 -04:00
python3-whitelist py3: whitelist 15 more tests passing on Python 3 2017-09-30 18:19:14 +05:30
python-hook-examples.py contrib: python-hook-examples use absolute_import 2016-03-16 04:13:28 +05:30
revsetbenchmarks.py py3: make contrib/revsetbenchmarks.py not import symbols from stdlib modules 2016-05-14 14:23:04 +09:00
showstack.py showstack: use absolute_import 2016-03-13 01:59:18 +05:30
simplemerge context: add arbitraryfilectx, which can represent files outside the workdir 2017-09-01 11:52:20 -07:00
synthrepo.py python3: replace sorted(<dict>.iterkeys()) with sorted(<dict>) 2017-08-22 20:06:58 -04:00
tcsh_completion contrib: update tcsh_completion for Mercurial 1.8 2011-03-01 07:28:20 +01:00
tcsh_completion_build.sh contrib: update tcsh_completion for Mercurial 1.8 2011-03-01 07:28:20 +01:00
undumprevlog undumprevlog: update to valid Python 3 syntax 2017-08-22 12:58:51 -04:00
xml.rnc Added RelaxNG schema for hg log XML output format 2009-12-30 02:44:37 +01:00
zsh_completion zsh_completion: add '--partial' flag to completions for 'import' (issue5618) 2017-07-12 10:11:02 +02:00