Debian Codegraph @

tests/test-contrib-perf.t

raw
1 #require test-repo
2
3 Set vars:
4
5 $ . "$TESTDIR/helpers-testrepo.sh"
6 $ CONTRIBDIR="$TESTDIR/../contrib"
7
8 Prepare repo:
9
10 $ hg init
11
12 $ echo this is file a > a
13 $ hg add a
14 $ hg commit -m first
15
16 $ echo adding to file a >> a
17 $ hg commit -m second
18
19 $ echo adding more to file a >> a
20 $ hg commit -m third
21
22 $ hg up -r 0
23 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 $ echo merge-this >> a
25 $ hg commit -m merge-able
26 created new head
27
28 $ hg up -r 2
29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
30
31 perfstatus
32
33 $ cat >> $HGRCPATH << EOF
34 > [extensions]
35 > perf=$CONTRIBDIR/perf.py
36 > [perf]
37 > presleep=0
38 > stub=on
39 > parentscount=1
40 > [storage]
41 > all-slow-path=allow
42 > EOF
43 $ hg help -e perf
44 perf extension - helper extension to measure performance
45
46 Configurations
47 ==============
48
49 "perf"
50 ------
51
52 "all-timing"
53 When set, additional statistics will be reported for each benchmark: best,
54 worst, median average. If not set only the best timing is reported
55 (default: off).
56
57 "presleep"
58 number of second to wait before any group of runs (default: 1)
59
60 "pre-run"
61 number of run to perform before starting measurement.
62
63 "profile-benchmark"
64 Enable profiling for the benchmarked section. (by default, the first
65 iteration is benchmarked)
66
67 "profiled-runs"
68 list of iteration to profile (starting from 0)
69
70 "run-limits"
71 Control the number of runs each benchmark will perform. The option value
72 should be a list of '<time>-<numberofrun>' pairs. After each run the
73 conditions are considered in order with the following logic:
74
75 If benchmark has been running for <time> seconds, and we have performed
76 <numberofrun> iterations, stop the benchmark,
77
78 The default value is: '3.0-100, 10.0-3'
79
80 "stub"
81 When set, benchmarks will only be run once, useful for testing (default:
82 off)
83
84 list of commands:
85
86 perf::addremove
87 (no help text available)
88 perf::ancestors
89 (no help text available)
90 perf::ancestorset
91 (no help text available)
92 perf::annotate
93 (no help text available)
94 perf::bdiff benchmark a bdiff between revisions
95 perf::bookmarks
96 benchmark parsing bookmarks from disk to memory
97 perf::branchmap
98 benchmark the update of a branchmap
99 perf::branchmapload
100 benchmark reading the branchmap
101 perf::branchmapupdate
102 benchmark branchmap update from for <base> revs to <target>
103 revs
104 perf::bundle benchmark the creation of a bundle from a repository
105 perf::bundleread
106 Benchmark reading of bundle files.
107 perf::cca (no help text available)
108 perf::changegroupchangelog
109 Benchmark producing a changelog group for a changegroup.
110 perf::changeset
111 (no help text available)
112 perf::ctxfiles
113 (no help text available)
114 perf::delta-find
115 benchmark the process of finding a valid delta for a revlog
116 revision
117 perf::diffwd Profile diff of working directory changes
118 perf::dirfoldmap
119 benchmap a 'dirstate._map.dirfoldmap.get()' request
120 perf::dirs (no help text available)
121 perf::dirstate
122 benchmap the time of various distate operations
123 perf::dirstatedirs
124 benchmap a 'dirstate.hasdir' call from an empty 'dirs' cache
125 perf::dirstatefoldmap
126 benchmap a 'dirstate._map.filefoldmap.get()' request
127 perf::dirstatewrite
128 benchmap the time it take to write a dirstate on disk
129 perf::discovery
130 benchmark discovery between local repo and the peer at given
131 path
132 perf::file-index-read
133 benchmark looking up paths in the file index tree
134 perf::file-index-vacuum
135 benchmark vacuuming the file index tree file
136 perf::file-index-write
137 benchmark writing paths to the file index
138 perf::fncacheencode
139 (no help text available)
140 perf::fncacheload
141 (no help text available)
142 perf::fncachewrite
143 (no help text available)
144 perf::heads benchmark the computation of a changelog heads
145 perf::helper-mergecopies
146 find statistics about potential parameters for
147 'perfmergecopies'
148 perf::helper-pathcopies
149 find statistic about potential parameters for the
150 'perftracecopies'
151 perf::ignore benchmark operation related to computing ignore
152 perf::index benchmark index creation time followed by a lookup
153 perf::linelogedits
154 (no help text available)
155 perf::loadmarkers
156 benchmark the time to parse the on-disk markers for a repo
157 perf::log (no help text available)
158 perf::lookup (no help text available)
159 perf::lrucachedict
160 (no help text available)
161 perf::manifest
162 benchmark the time to read a manifest from disk and return a
163 usable
164 perf::mergecalculate
165 (no help text available)
166 perf::mergecopies
167 measure runtime of 'copies.mergecopies'
168 perf::moonwalk
169 benchmark walking the changelog backwards
170 perf::nodelookup
171 (no help text available)
172 perf::nodemap
173 benchmark the time necessary to look up revision from a cold
174 nodemap
175 perf::parents
176 benchmark the time necessary to fetch one changeset's parents.
177 perf::pathcopies
178 benchmark the copy tracing logic
179 perf::phases benchmark phasesets computation
180 perf::phasesremote
181 benchmark time needed to analyse phases of the remote server
182 perf::progress
183 printing of progress bars
184 perf::rawfiles
185 (no help text available)
186 perf::revlog-read-revisions
187 Benchmark reading a series of revisions from a revlog.
188 perf::revlog-revdiff
189 check how long it take to redelta a set of revision pair
190 perf::revlogchunks
191 Benchmark operations on revlog chunks.
192 perf::revlogindex
193 Benchmark operations against a revlog index.
194 perf::revlogrevision
195 Benchmark obtaining a revlog revision.
196 perf::revlogwrite
197 Benchmark writing a series of revisions to a revlog.
198 perf::revrange
199 (no help text available)
200 perf::revset benchmark the execution time of a revset
201 perf::startup
202 (no help text available)
203 perf::status benchmark the performance of a single status call
204 perf::stream-consume
205 benchmark the full application of a stream clone
206 perf::stream-generate
207 benchmark the full generation of a stream clone
208 perf::stream-locked-section
209 benchmark the initial, repo-locked, section of a stream-clone
210 perf::tags Benchmark tags retrieval in various situation
211 perf::templating
212 test the rendering time of a given template
213 perf::unbundle
214 benchmark application of a bundle in a repository.
215 perf::unidiff
216 benchmark a unified diff between revisions
217 perf::volatilesets
218 benchmark the computation of various volatile set
219 perf::walk (no help text available)
220 perf::write microbenchmark ui.write (and others)
221
222 (use 'hg help -v perf' to show built-in aliases and global options)
223
224 $ hg help perfaddremove
225 hg perf::addremove
226
227 aliases: perfaddremove
228
229 (no help text available)
230
231 options:
232
233 -T --template TEMPLATE display with template
234
235 (some details hidden, use --verbose to show complete help)
236
237 $ hg perfaddremove
238 $ hg perfancestors
239 $ hg perfancestorset 2
240 $ hg perfannotate a
241 $ hg perfbdiff -c 1
242 $ hg perfbdiff --alldata 1
243 $ hg perfunidiff -c 1
244 $ hg perfunidiff --alldata 1
245 $ hg perfbookmarks
246 $ hg perfbranchmap
247 $ hg perfbranchmapload
248 $ hg perfbranchmapupdate --base "not tip" --target "tip"
249 benchmark of branchmap with 3 revisions with 1 new ones
250 $ hg perfcca
251 $ hg perfchangegroupchangelog
252 $ hg perfchangegroupchangelog --cgversion 01
253 $ hg perfchangeset 2
254 $ hg perfctxfiles 2
255 $ hg perfdiffwd
256 $ hg perfdirfoldmap
257 $ hg perfdirs
258 $ hg perfdirstate
259 $ hg perfdirstate --contains
260 $ hg perfdirstate --iteration
261 $ hg perfdirstatedirs
262 $ hg perfdirstatefoldmap
263 $ hg perfdirstatewrite
264 $ hg perffncacheencode
265 $ hg perffncacheload
266 $ hg debugrebuildfncache
267 fncache already up to date
268 $ hg perffncachewrite
269 $ hg debugrebuildfncache
270 fncache already up to date
271
272 Temporarily upgrade to file index to test file index commands
273 $ hg debugupgrade --config format.use-fileindex-v1=1 --no-backup --run > /dev/null
274 $ hg perf::file-index-read --seed 0
275 looking up 1 out of 1 paths (random order)
276 $ hg perf::file-index-read --count 100% --order sorted
277 looking up 1 out of 1 paths (sorted order)
278 $ hg perf::file-index-write --count 1 --seed 0
279 $ hg perf::file-index-vacuum
280 $ hg debugupgrade --no-backup --run > /dev/null
281
282 $ hg perfheads
283 $ hg perfignore
284 $ hg perfindex
285 $ hg perflinelogedits -n 1
286 $ hg perfloadmarkers
287 $ hg perflog
288 $ hg perflookup 2
289 $ hg perflrucache
290 $ hg perfmanifest 2
291 $ hg perfmanifest -m 44fe2c8352bb3a478ffd7d8350bbc721920134d1
292 $ hg perfmanifest -m 44fe2c8352bb
293 abort: manifest revision must be integer or full node
294 [255]
295 $ hg perfmergecalculate -r 3
296 $ hg perfmoonwalk
297 $ hg perfnodelookup 2
298 $ hg perfpathcopies 1 2
299 $ hg perfprogress --total 1000
300 $ hg perfrawfiles 2
301 $ hg perfrevlogindex -c
302 $ hg perfrevlogrevisions .hg/store/data/a.i
303
304 #if no-rust
305 Cannot test in Rust because this these are highly invasive and expect a certain
306 structure from Python code.
307
308 $ hg perfrevlogrevision -m 0
309 $ hg perfrevlogchunks -c
310 #endif
311
312 $ hg perfrevrange
313 $ hg perfrevset 'all()'
314 $ hg perfstartup
315 $ hg perfstatus
316 $ hg perfstatus --dirstate
317 $ hg perftags
318 $ hg perftemplating
319 $ hg perfvolatilesets
320 $ hg perfwalk
321 $ hg perfparents
322 $ hg perfdiscovery -q .
323 $ hg perf::phases
324
325 $ hg perf::stream-generate
326 $ hg perf::stream-locked-section
327
328 Test run control
329 ----------------
330
331 Simple single entry
332
333 $ hg perfparents --config perf.stub=no --config perf.run-limits='0.000000001-15'
334 ! wall * comb * user * sys * (best of 15) (glob)
335 ! wall * comb * user * sys * (max of 15) (glob)
336 ! wall * comb * user * sys * (avg of 15) (glob)
337 ! wall * comb * user * sys * (median of 15) (glob)
338
339 Multiple entries
340
341 $ hg perfparents --config perf.stub=no --config perf.run-limits='500000-1, 0.000000001-50'
342 ! wall * comb * user * sys * (best of 50) (glob)
343 ! wall * comb * user * sys * (max of 50) (glob)
344 ! wall * comb * user * sys * (avg of 50) (glob)
345 ! wall * comb * user * sys * (median of 50) (glob)
346
347 error case are ignored
348
349 $ hg perfparents --config perf.stub=no --config perf.run-limits='500, 0.000000001-50'
350 malformatted run limit entry, missing "-": 500
351 ! wall * comb * user * sys * (best of 50) (glob)
352 ! wall * comb * user * sys * (max of 50) (glob)
353 ! wall * comb * user * sys * (avg of 50) (glob)
354 ! wall * comb * user * sys * (median of 50) (glob)
355 $ hg perfparents --config perf.stub=no --config perf.run-limits='aaa-120, 0.000000001-50'
356 malformatted run limit entry, could not convert string to float: 'aaa': aaa-120
357 ! wall * comb * user * sys * (best of 50) (glob)
358 ! wall * comb * user * sys * (max of 50) (glob)
359 ! wall * comb * user * sys * (avg of 50) (glob)
360 ! wall * comb * user * sys * (median of 50) (glob)
361 $ hg perfparents --config perf.stub=no --config perf.run-limits='120-aaaaaa, 0.000000001-50'
362 malformatted run limit entry, invalid literal for int() with base 10: 'aaaaaa': 120-aaaaaa
363 ! wall * comb * user * sys * (best of 50) (glob)
364 ! wall * comb * user * sys * (max of 50) (glob)
365 ! wall * comb * user * sys * (avg of 50) (glob)
366 ! wall * comb * user * sys * (median of 50) (glob)
367
368 test actual output
369 ------------------
370
371 normal output:
372
373 $ hg perfheads --config perf.stub=no
374 ! wall * comb * user * sys * (best of *) (glob)
375 ! wall * comb * user * sys * (max of *) (glob)
376 ! wall * comb * user * sys * (avg of *) (glob)
377 ! wall * comb * user * sys * (median of *) (glob)
378
379 detailed output:
380
381 $ hg perfheads --config perf.all-timing=yes --config perf.stub=no
382 ! wall * comb * user * sys * (best of *) (glob)
383 ! wall * comb * user * sys * (max of *) (glob)
384 ! wall * comb * user * sys * (avg of *) (glob)
385 ! wall * comb * user * sys * (median of *) (glob)
386
387 test json output
388 ----------------
389
390 normal output:
391
392 $ hg perfheads --template json --config perf.stub=no
393 [
394 {
395 "avg.comb": *, (glob)
396 "avg.count": *, (glob)
397 "avg.sys": *, (glob)
398 "avg.user": *, (glob)
399 "avg.wall": *, (glob)
400 "comb": *, (glob)
401 "count": *, (glob)
402 "max.comb": *, (glob)
403 "max.count": *, (glob)
404 "max.sys": *, (glob)
405 "max.user": *, (glob)
406 "max.wall": *, (glob)
407 "median.comb": *, (glob)
408 "median.count": *, (glob)
409 "median.sys": *, (glob)
410 "median.user": *, (glob)
411 "median.wall": *, (glob)
412 "sys": *, (glob)
413 "user": *, (glob)
414 "wall": * (glob)
415 }
416 ]
417
418 detailed output:
419
420 $ hg perfheads --template json --config perf.all-timing=yes --config perf.stub=no
421 [
422 {
423 "avg.comb": *, (glob)
424 "avg.count": *, (glob)
425 "avg.sys": *, (glob)
426 "avg.user": *, (glob)
427 "avg.wall": *, (glob)
428 "comb": *, (glob)
429 "count": *, (glob)
430 "max.comb": *, (glob)
431 "max.count": *, (glob)
432 "max.sys": *, (glob)
433 "max.user": *, (glob)
434 "max.wall": *, (glob)
435 "median.comb": *, (glob)
436 "median.count": *, (glob)
437 "median.sys": *, (glob)
438 "median.user": *, (glob)
439 "median.wall": *, (glob)
440 "sys": *, (glob)
441 "user": *, (glob)
442 "wall": * (glob)
443 }
444 ]
445
446 Test pre-run feature
447 --------------------
448
449 (perf discovery has some spurious output)
450
451 $ hg perfdiscovery . --config perf.stub=no --config perf.run-limits='0.000000001-1' --config perf.pre-run=0
452 ! wall * comb * user * sys * (best of 1) (glob)
453 ! wall * comb * user * sys * (max of 1) (glob)
454 ! wall * comb * user * sys * (avg of 1) (glob)
455 ! wall * comb * user * sys * (median of 1) (glob)
456 searching for changes
457 $ hg perfdiscovery . --config perf.stub=no --config perf.run-limits='0.000000001-1' --config perf.pre-run=1
458 ! wall * comb * user * sys * (best of 1) (glob)
459 ! wall * comb * user * sys * (max of 1) (glob)
460 ! wall * comb * user * sys * (avg of 1) (glob)
461 ! wall * comb * user * sys * (median of 1) (glob)
462 searching for changes
463 searching for changes
464 $ hg perfdiscovery . --config perf.stub=no --config perf.run-limits='0.000000001-1' --config perf.pre-run=3
465 ! wall * comb * user * sys * (best of 1) (glob)
466 ! wall * comb * user * sys * (max of 1) (glob)
467 ! wall * comb * user * sys * (avg of 1) (glob)
468 ! wall * comb * user * sys * (median of 1) (glob)
469 searching for changes
470 searching for changes
471 searching for changes
472 searching for changes
473 $ hg perf::bundle 'last(all(), 5)'
474 $ hg bundle --exact --rev 'last(all(), 5)' last-5.hg
475 4 changesets found
476 $ hg perf::unbundle last-5.hg
477
478
479 test profile-benchmark option
480 ------------------------------
481
482 Function to check that statprof ran
483 $ statprofran () {
484 > grep -E 'Sample count:|No samples recorded' > /dev/null
485 > }
486 $ hg perfdiscovery . --config perf.stub=no --config perf.run-limits='0.000000001-1' --config perf.profile-benchmark=yes 2>&1 | statprofran
487
488 Check perf.py for historical portability
489 ----------------------------------------
490
491 $ cd "$TESTDIR/.."
492
493 $ (testrepohg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py;
494 > testrepohg files -r tip glob:mercurial/*.c glob:mercurial/*.py) |
495 > "$TESTDIR"/check-perf-code.py contrib/perf.py
496 contrib/perf.py:\d+: (re)
497 > from mercurial import (
498 import newer module separately in try clause for early Mercurial
499 contrib/perf.py:\d+: (re)
500 > from mercurial import (
501 import newer module separately in try clause for early Mercurial
502 contrib/perf.py:\d+: (re)
503 > origindexpath = orig.opener.join(indexfile)
504 use getvfs()/getsvfs() for early Mercurial
505 contrib/perf.py:\d+: (re)
506 > origdatapath = orig.opener.join(datafile)
507 use getvfs()/getsvfs() for early Mercurial
508 contrib/perf.py:\d+: (re)
509 > vfs = vfsmod.vfs(tmpdir)
510 use getvfs()/getsvfs() for early Mercurial
511 contrib/perf.py:\d+: (re)
512 > vfs.options = getattr(orig.opener, 'options', None)
513 use getvfs()/getsvfs() for early Mercurial
514 [1]