sapling/eden/scm/tests/test-perftrace.t
Durham Goode f09839fdf9 merge: don't do checkunknown for files that we know are not untracked
Summary:
checkunknown is quite expensive since it has to read the contents of
every untracked file, which can be 10's of thousands of non-parallel stats and
reads. For files that don't exist in the working copy, it's just wasted work to
stat for the files at all. Status can efficiently tell us what files are
unknown, so let's use that to triage most "unknown" files to normal writes
before we even get to checkunknown.

The downside of this approach is that it makes an additional call to status,
which is not cached (only non-unknown+non-ignore+non-clean status calls are
cached). We could add more caching if this is a problem.

This doesn't help the case where a user might have 10k+ untracked files due to a
ctrl+c'd checkout, but we'll improve that in a future diff.

Reviewed By: quark-zju

Differential Revision: D22366758

fbshipit-source-id: b54fec113dc162f97a35e705ed083ddd14babe55
2020-07-06 22:10:56 -07:00

63 lines
3.5 KiB
Perl

#require no-fsmonitor
$ setconfig tracing.threshold=0
$ newrepo
$ drawdag << 'EOS'
> C
> |
> B
> |
> A
> EOS
$ TRACING_DATA_FAKE_CLOCK=5000 hg up $C --config tracing.stderr=True 2> trace
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ sed 's/line [0-9]*$/_/' trace
Process _ Thread _:
Start Dur.ms | Name Source
5 ... | Run Command hgcommands::run _
| - pid = 0 :
| - uid = 0 :
| - nice = 0 :
| - args = ["hg","up","26805aba1e600a82e9... :
| - parent_pids = [] :
| - parent_names = [] :
| - exit_code = 0 :
| - max_rss = 0 :
10 +5 \ Initialize Python hgcommands::hgpython _
20 +5 \ import edenscm hgcommands::hgpython _
30 +195 \ Main Python Command (perftrace)
35 +5 \ Repo Setup edenscm.mercurial.hg line _
| - local = true :
45 +175 \ Update edenscm.mercurial.util line _
50 +165 | Timed Function: mergeupdate edenscm.mercurial.merge line _
55 +35 \ Status edenscm.mercurial.dirstate line _
| - A/M/R Files = 0 :
60 +5 \ Timed Function: fswalk edenscm.mercurial.filesystem line _
70 +5 \ _rustwalk.next (generator)
80 +5 \ _rustwalk.next (generator)
95 +75 \ Progress Bar: calculating (progressbar)
100 +65 | Calculate Updates edenscm.mercurial.merge line _
105 +35 \ Status edenscm.mercurial.dirstate line _
| - A/M/R Files = 0 :
| - Unknown Files = 1 :
110 +5 \ Timed Function: fswalk edenscm.mercurial.filesystem line _
120 +5 \ _rustwalk.next (generator)
130 +5 \ _rustwalk.next (generator)
145 +5 \ Manifest Diff (perftrace)
| - Differences = 3 :
| - Tree Fetches = 0 :
155 +5 \ Check Unknown Files edenscm.mercurial.merge line _
175 +25 \ Apply Updates edenscm.mercurial.util line _
| - Actions = 3 :
| - Disk Writes = 3 :
| - Deleted Files = 0 :
| - Written Files = 3 :
180 +15 | Timed Function: applyupdates edenscm.mercurial.merge line _
185 +5 | Progress Bar: updating (progressbar)
| - total = 3 :
205 +5 \ Progress Bar: recording (progressbar)
| - total = 3 :