tests/test-fastannotate-perfhack.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Sun, 14 Apr 2024 02:33:36 +0200
changeset 51587 8cd317c033b8
parent 42151 7116fc614cfc
permissions -rw-r--r--
stream-clone: disable gc for the entry listing section for the v2 format This is similar to the change we did for the v3 format in 6e4c8366c5ce. The benchmark bellow show this gives us a notable gains, especially on larger repositories. ### benchmark.name = hg.perf.stream-locked-section # benchmark.name = hg.perf.stream-locked-section # bin-env-vars.hg.flavor = default # bin-env-vars.hg.py-re2-module = default # benchmark.variants.version = v2 ## data-env-vars.name = pypy-2018-08-01-zstd-sparse-revlog 5e931bf8707c: 0.503820 ~~~~~ 1106d1bf695e: 0.470078 (-6.70%, -0.03) ## data-env-vars.name = pypy-2024-03-22-zstd-sparse-revlog 5e931bf8707c: 0.535756 ~~~~~ 1106d1bf695e: 0.490249 (-8.49%, -0.05) ## data-env-vars.name = heptapod-public-2024-03-25-zstd-sparse-revlog 5e931bf8707c: 1.327041 ~~~~~ 1106d1bf695e: 1.174636 (-11.48%, -0.15) ## data-env-vars.name = netbeans-2018-08-01-zstd-sparse-revlog 5e931bf8707c: 2.439158 ~~~~~ 1106d1bf695e: 2.220515 (-8.96%, -0.22) ## data-env-vars.name = netbeans-2019-11-07-zstd-sparse-revlog 5e931bf8707c: 2.630794 ~~~~~ 1106d1bf695e: 2.261473 (-14.04%, -0.37) ## data-env-vars.name = mozilla-central-2018-08-01-zstd-sparse-revlog 5e931bf8707c: 5.769002 ~~~~~ 1106d1bf695e: 5.062000 (-12.26%, -0.71) ## data-env-vars.name = mozilla-try-2019-02-18-zstd-sparse-revlog 5e931bf8707c: 13.351750 ~~~~~ 1106d1bf695e: 12.346655 (-7.53%, -1.01) ## data-env-vars.name = mozilla-central-2024-03-22-zstd-sparse-revlog 5e931bf8707c: 10.772939 ~~~~~ 1106d1bf695e: 9.495407 (-11.86%, -1.28) ## data-env-vars.name = mozilla-unified-2024-03-22-zstd-sparse-revlog 5e931bf8707c: 10.864297 ~~~~~ 1106d1bf695e: 9.475597 (-12.78%, -1.39) ## data-env-vars.name = mozilla-try-2023-03-22-zstd-sparse-revlog 5e931bf8707c: 17.448335 ~~~~~ 1106d1bf695e: 16.027474 (-8.14%, -1.42)

  $ cat >> $HGRCPATH << EOF
  > [extensions]
  > fastannotate=
  > [fastannotate]
  > perfhack=1
  > EOF

  $ hg init repo
  $ cd repo

a simple merge case

  $ echo 1 > a
  $ hg commit -qAm 'append 1'
  $ echo 2 >> a
  $ hg commit -m 'append 2'
  $ echo 3 >> a
  $ hg commit -m 'append 3'
  $ hg up 1 -q
  $ cat > a << EOF
  > 0
  > 1
  > 2
  > EOF
  $ hg commit -qm 'insert 0'
  $ hg merge 2 -q
  $ echo 4 >> a
  $ hg commit -m merge
  $ hg log -G -T '{rev}: {desc}'
  @    4: merge
  |\
  | o  3: insert 0
  | |
  o |  2: append 3
  |/
  o  1: append 2
  |
  o  0: append 1
  
  $ hg fastannotate a
  3: 0
  0: 1
  1: 2
  2: 3
  4: 4
  $ hg fastannotate -r 0 a
  0: 1
  $ hg fastannotate -r 1 a
  0: 1
  1: 2
  $ hg fastannotate -udnclf a
  test 3 d641cb51f61e Thu Jan 01 00:00:00 1970 +0000 a:1: 0
  test 0 4994017376d3 Thu Jan 01 00:00:00 1970 +0000 a:1: 1
  test 1 e940cb6d9a06 Thu Jan 01 00:00:00 1970 +0000 a:2: 2
  test 2 26162a884ba6 Thu Jan 01 00:00:00 1970 +0000 a:3: 3
  test 4 3ad7bcd2815f Thu Jan 01 00:00:00 1970 +0000 a:5: 4
  $ hg fastannotate --linear a
  3: 0
  0: 1
  1: 2
  4: 3
  4: 4

incrementally updating

  $ hg fastannotate -r 0 a --debug
  fastannotate: a: using fast path (resolved fctx: True)
  0: 1
  $ hg fastannotate -r 0 a --debug --rebuild
  fastannotate: a: 1 new changesets in the main branch
  0: 1
  $ hg fastannotate -r 1 a --debug
  fastannotate: a: 1 new changesets in the main branch
  0: 1
  1: 2
  $ hg fastannotate -r 3 a --debug
  fastannotate: a: 1 new changesets in the main branch
  3: 0
  0: 1
  1: 2
  $ hg fastannotate -r 4 a --debug
  fastannotate: a: 1 new changesets in the main branch
  3: 0
  0: 1
  1: 2
  2: 3
  4: 4
  $ hg fastannotate -r 1 a --debug
  fastannotate: a: using fast path (resolved fctx: True)
  0: 1
  1: 2

rebuild happens automatically if unable to update

  $ hg fastannotate -r 2 a --debug
  fastannotate: a: cache broken and deleted
  fastannotate: a: 3 new changesets in the main branch
  0: 1
  1: 2
  2: 3

config option "fastannotate.mainbranch"

  $ hg fastannotate -r 1 --rebuild --config fastannotate.mainbranch=tip a --debug
  fastannotate: a: 4 new changesets in the main branch
  0: 1
  1: 2
  $ hg fastannotate -r 4 a --debug
  fastannotate: a: using fast path (resolved fctx: True)
  3: 0
  0: 1
  1: 2
  2: 3
  4: 4

rename

  $ hg mv a b
  $ cat > b << EOF
  > 0
  > 11
  > 3
  > 44
  > EOF
  $ hg commit -m b -q
  $ hg fastannotate -ncf --long-hash b
  3 d641cb51f61e331c44654104301f8154d7865c89 a: 0
  5 d44dade239915bc82b91e4556b1257323f8e5824 b: 11
  2 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a: 3
  5 d44dade239915bc82b91e4556b1257323f8e5824 b: 44
  $ hg fastannotate -r 26162a884ba60e8c87bf4e0d6bb8efcc6f711a4e a
  0: 1
  1: 2
  2: 3

fastannotate --deleted

  $ hg fastannotate --deleted -nf b
  3 a:  0
  5 b:  11
  0 a: -1
  1 a: -2
  2 a:  3
  5 b:  44
  4 a: -4
  $ hg fastannotate --deleted -r 3 -nf a
  3 a:  0
  0 a:  1
  1 a:  2

file and directories with ".l", ".m" suffixes

  $ cd ..
  $ hg init repo2
  $ cd repo2

  $ mkdir a.l b.m c.lock a.l.hg b.hg
  $ for i in a b c d d.l d.m a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a; do
  >   echo $i > $i
  > done
  $ hg add . -q
  $ hg commit -m init
  $ hg fastannotate a.l/a b.m/a c.lock/a a.l.hg/a b.hg/a d.l d.m a b c d
  0: a
  0: a.l.hg/a
  0: a.l/a
  0: b
  0: b.hg/a
  0: b.m/a
  0: c
  0: c.lock/a
  0: d
  0: d.l
  0: d.m

empty file

  $ touch empty
  $ hg commit -A empty -m empty
  $ hg fastannotate empty