Mercurial > hg
annotate contrib/plan9/mkfile @ 47120:7109a38830c9
dirstate-tree: Fold "tracked descendants" counter update in main walk
For the purpose of implementing `has_tracked_dir` (which means "has tracked
descendants) without an expensive sub-tree traversal, we maintaing a counter
of tracked descendants on each "directory" node of the tree-shaped dirstate.
Before this changeset, mutating or inserting a node at a given path would
involve:
* Walking the tree from root through ancestors to find the node or the spot
where to insert it
* Looking at the previous node if any to decide what counter update is needed
* Performing any node mutation
* Walking the tree *again* to update counters in ancestor nodes
When profiling `hg status` on a large repo, this second walk takes times
while loading a the dirstate from disk.
It turns out we have enough information to decide before he first tree walk
what counter update is needed. This changeset merges the two walks, gaining
~10% of the total time for `hg update` (in the same hyperfine benchmark as
the previous changeset).
---
Profiling was done by compiling with this `.cargo/config`:
[profile.release]
debug = true
then running with:
py-spy record -r 500 -n -o /tmp/hg.json --format speedscope -- \
./hg status -R $REPO --config experimental.dirstate-tree.in-memory=1
then visualizing the recorded JSON file in https://www.speedscope.app/
Differential Revision: https://phab.mercurial-scm.org/D10554
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Fri, 30 Apr 2021 14:22:14 +0200 |
parents | f9262456fb01 |
children |
rev | line source |
---|---|
16383
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
1 APE=/sys/src/ape |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
2 <$APE/config |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
3 |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
4 PYTHON=python |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
5 PYTHONBIN=/rc/bin |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
6 SH=ape/psh |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
7 |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
8 PURE=--pure |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
9 ROOT=../.. |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
10 |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
11 # This is slightly underhanded; Plan 9 does not support GNU gettext nor |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
12 # does it support dynamically loaded extension modules. We work around |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
13 # this by calling build_py and build_scripts directly; this avoids |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
14 # additional platform hacks in setup.py. |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
15 build:VQ: |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
16 @{ |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
17 cd $ROOT |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
18 $SH -c '$PYTHON setup.py $PURE build_py build_scripts' |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
19 } |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
20 |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
21 clean:VQ: |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
22 @{ |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
23 cd $ROOT |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
24 $SH -c '$PYTHON setup.py $PURE clean --all' |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
25 } |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
26 |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
27 install:VQ: build |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
28 @{ |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
29 cd $ROOT |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
30 $SH -c '$PYTHON setup.py $PURE install \ |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
31 --install-scripts $PYTHONBIN \ |
16556
f9262456fb01
plan9: mkfile and 9diff fixes
Steven Stallion <sstallion@gmail.com>
parents:
16383
diff
changeset
|
32 --skip-build \ |
f9262456fb01
plan9: mkfile and 9diff fixes
Steven Stallion <sstallion@gmail.com>
parents:
16383
diff
changeset
|
33 --force' |
16383
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
34 } |
f5dd179bfa4a
plan9: initial support for plan 9 from bell labs
Steven Stallion <sstallion@gmail.com>
parents:
diff
changeset
|
35 mkdir -p /lib/mercurial/hgrc.d |
16556
f9262456fb01
plan9: mkfile and 9diff fixes
Steven Stallion <sstallion@gmail.com>
parents:
16383
diff
changeset
|
36 dircp hgrc.d /lib/mercurial/hgrc.d/ |
f9262456fb01
plan9: mkfile and 9diff fixes
Steven Stallion <sstallion@gmail.com>
parents:
16383
diff
changeset
|
37 cp 9diff /rc/bin/ |