sapling/tests/test-contrib-perf.t
Gregory Szorc 96e04b10aa perf: add command to benchmark bundle reading
Upcoming commits will be refactoring bundle2 I/O code.

This commit establishes a `hg perfbundleread` command that measures
how long it takes to read a bundle using various mechanisms.

As a baseline, here's output from an uncompressed bundle1
bundle of my Firefox repo (7,098,622,890 bytes):

! read(8k)
! wall 0.763481 comb 0.760000 user 0.160000 sys 0.600000 (best of 6)
! read(16k)
! wall 0.644512 comb 0.640000 user 0.110000 sys 0.530000 (best of 16)
! read(32k)
! wall 0.581172 comb 0.590000 user 0.060000 sys 0.530000 (best of 18)
! read(128k)
! wall 0.535183 comb 0.530000 user 0.010000 sys 0.520000 (best of 19)
! cg1 deltaiter()
! wall 0.873500 comb 0.880000 user 0.840000 sys 0.040000 (best of 12)
! cg1 getchunks()
! wall 6.283797 comb 6.270000 user 5.570000 sys 0.700000 (best of 3)
! cg1 read(8k)
! wall 1.097173 comb 1.100000 user 0.400000 sys 0.700000 (best of 10)
! cg1 read(16k)
! wall 0.810750 comb 0.800000 user 0.200000 sys 0.600000 (best of 13)
! cg1 read(32k)
! wall 0.671215 comb 0.670000 user 0.110000 sys 0.560000 (best of 15)
! cg1 read(128k)
! wall 0.597857 comb 0.600000 user 0.020000 sys 0.580000 (best of 15)

And from an uncompressed bundle2 bundle (6,070,036,163 bytes):

! read(8k)
! wall 0.676997 comb 0.680000 user 0.160000 sys 0.520000 (best of 15)
! read(16k)
! wall 0.592706 comb 0.590000 user 0.080000 sys 0.510000 (best of 17)
! read(32k)
! wall 0.529395 comb 0.530000 user 0.050000 sys 0.480000 (best of 16)
! read(128k)
! wall 0.491270 comb 0.490000 user 0.010000 sys 0.480000 (best of 19)
! bundle2 forwardchunks()
! wall 2.997131 comb 2.990000 user 2.270000 sys 0.720000 (best of 4)
! bundle2 iterparts()
! wall 12.247197 comb 10.670000 user 8.170000 sys 2.500000 (best of 3)
! bundle2 part seek()
! wall 11.761675 comb 10.500000 user 8.240000 sys 2.260000 (best of 3)
! bundle2 part read(8k)
! wall 9.116163 comb 9.110000 user 8.240000 sys 0.870000 (best of 3)
! bundle2 part read(16k)
! wall 8.984362 comb 8.970000 user 8.110000 sys 0.860000 (best of 3)
! bundle2 part read(32k)
! wall 8.758364 comb 8.740000 user 7.860000 sys 0.880000 (best of 3)
! bundle2 part read(128k)
! wall 8.749040 comb 8.730000 user 7.830000 sys 0.900000 (best of 3)

We already see some interesting data. Notably that bundle2 has
significant overhead compared to bundle1. This matters for e.g. stream
clone bundles, which can be applied at >1Gbps.

Differential Revision: https://phab.mercurial-scm.org/D1385
2017-11-13 19:20:34 -08:00

182 lines
5.1 KiB
Perl

#require test-repo
Set vars:
$ . "$TESTDIR/helpers-testrepo.sh"
$ CONTRIBDIR="$TESTDIR/../contrib"
Prepare repo:
$ hg init
$ echo this is file a > a
$ hg add a
$ hg commit -m first
$ echo adding to file a >> a
$ hg commit -m second
$ echo adding more to file a >> a
$ hg commit -m third
$ hg up -r 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo merge-this >> a
$ hg commit -m merge-able
created new head
$ hg up -r 2
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
perfstatus
$ cat >> $HGRCPATH << EOF
> [extensions]
> perfstatusext=$CONTRIBDIR/perf.py
> [perf]
> presleep=0
> stub=on
> parentscount=1
> EOF
$ hg help perfstatusext
perfstatusext extension - helper extension to measure performance
list of commands:
perfaddremove
(no help text available)
perfancestors
(no help text available)
perfancestorset
(no help text available)
perfannotate (no help text available)
perfbdiff benchmark a bdiff between revisions
perfbookmarks
benchmark parsing bookmarks from disk to memory
perfbranchmap
benchmark the update of a branchmap
perfbundleread
Benchmark reading of bundle files.
perfcca (no help text available)
perfchangegroupchangelog
Benchmark producing a changelog group for a changegroup.
perfchangeset
(no help text available)
perfctxfiles (no help text available)
perfdiffwd Profile diff of working directory changes
perfdirfoldmap
(no help text available)
perfdirs (no help text available)
perfdirstate (no help text available)
perfdirstatedirs
(no help text available)
perfdirstatefoldmap
(no help text available)
perfdirstatewrite
(no help text available)
perffncacheencode
(no help text available)
perffncacheload
(no help text available)
perffncachewrite
(no help text available)
perfheads (no help text available)
perfindex (no help text available)
perfloadmarkers
benchmark the time to parse the on-disk markers for a repo
perflog (no help text available)
perflookup (no help text available)
perflrucachedict
(no help text available)
perfmanifest (no help text available)
perfmergecalculate
(no help text available)
perfmoonwalk benchmark walking the changelog backwards
perfnodelookup
(no help text available)
perfparents (no help text available)
perfpathcopies
(no help text available)
perfphases benchmark phasesets computation
perfrawfiles (no help text available)
perfrevlogchunks
Benchmark operations on revlog chunks.
perfrevlogindex
Benchmark operations against a revlog index.
perfrevlogrevision
Benchmark obtaining a revlog revision.
perfrevlogrevisions
Benchmark reading a series of revisions from a revlog.
perfrevrange (no help text available)
perfrevset benchmark the execution time of a revset
perfstartup (no help text available)
perfstatus (no help text available)
perftags (no help text available)
perftemplating
(no help text available)
perfvolatilesets
benchmark the computation of various volatile set
perfwalk (no help text available)
perfwrite microbenchmark ui.write
(use 'hg help -v perfstatusext' to show built-in aliases and global options)
$ hg perfaddremove
$ hg perfancestors
$ hg perfancestorset 2
$ hg perfannotate a
$ hg perfbdiff -c 1
$ hg perfbdiff --alldata 1
$ hg perfbookmarks
$ hg perfbranchmap
$ hg perfcca
$ hg perfchangegroupchangelog
$ hg perfchangeset 2
$ hg perfctxfiles 2
$ hg perfdiffwd
$ hg perfdirfoldmap
$ hg perfdirs
$ hg perfdirstate
$ hg perfdirstatedirs
$ hg perfdirstatefoldmap
$ hg perfdirstatewrite
$ hg perffncacheencode
$ hg perffncacheload
$ hg perffncachewrite
$ hg perfheads
$ hg perfindex
$ hg perfloadmarkers
$ hg perflog
$ hg perflookup 2
$ hg perflrucache
$ hg perfmanifest 2
$ hg perfmergecalculate -r 3
$ hg perfmoonwalk
$ hg perfnodelookup 2
$ hg perfpathcopies 1 2
$ hg perfrawfiles 2
$ hg perfrevlogindex -c
$ hg perfrevlogrevisions .hg/store/data/a.i
$ hg perfrevlogrevision -m 0
$ hg perfrevlogchunks -c
$ hg perfrevrange
$ hg perfrevset 'all()'
$ hg perfstartup
$ hg perfstatus
$ hg perftags
$ hg perftemplating
$ hg perfvolatilesets
$ hg perfwalk
$ hg perfparents
Check perf.py for historical portability
$ cd "$TESTDIR/.."
$ (testrepohg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py;
> testrepohg files -r tip glob:mercurial/*.c glob:mercurial/*.py) |
> "$TESTDIR"/check-perf-code.py contrib/perf.py
contrib/perf.py:498:
> from mercurial import (
import newer module separately in try clause for early Mercurial
[1]