Message4548

Author pmezard
Recipients jglick, jmr, mpm
Date 2007-12-09.18:28:27
Content
(A first version went by mail but did not get there after 30mn, so I am
copy/pasting it).

Matt Mackall a écrit :
> > Matt Mackall <mpm@selenic.com> added the comment:
> > 
> > On Sat, Dec 08, 2007 at 09:39:26AM -0000, Patrick M??zard wrote:
>> >> Patrick M??zard <pmezard@gmail.com> added the comment:

[...]

>> >>
>> >> $ echo a > o.o.util/src/org/netbeans/modules/openide/util/AWTBridge.java
>> >> $ time hg st
>> >> M o.o.util/src/org/netbeans/modules/openide/util/AWTBridge.java
>> >>
>> >> real    0m12.507s
>> >> user    0m3.960s
>> >> sys     0m6.003s
> > 
> > I assume this is cache-hot too.

Yes

> > 
>> >> $ hg --debug --profile revert
>> >> o.o.util/src/org/netbeans/modules/openide/util/AWTBridge.java

[...]

>> >>
>> >>    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
>> >>         2   12.251    6.126   13.805    6.903 dirstate.py:434(findfiles)
>> >>    340333    0.764    0.000    0.764    0.000 posixpath.py:56(join)
>> >>     67301    0.491    0.000   15.239    0.000 dirstate.py:382(statwalk)
>> >>     78/40    0.420    0.005    0.501    0.013 demandimport.py:43(_load)
>> >>     36471    0.401    0.000    0.401    0.000 posixpath.py:374(normpath)
>> >>         1    0.386    0.386    0.490    0.490 dirstate.py:130(_read)
>> >>         2    0.329    0.165   14.632    7.316 dirstate.py:523(status)
> > 
> > We spend most of our time checking the repo status. Is this 0.9.5?

This is crew before this week-end updates:

changeset:   5593:2e76e5a23c2b
tag:         qparent
user:        Steve Borho <steve@borho.org>
date:        Mon Dec 03 17:28:26 2007 -0600
summary:     workaround for raw_input() on Windows

> > 
>> >>         1    0.013    0.013    8.138    8.138 hg.py:292(revert)
> > 
> > And something in here is taking a while too, but it's not clear what.

That's merge working context _status being computed.


I made more tests with crew tip. First I added some timing code in
commands.revert() and merge.update(). Most time is spent in revert() status()
call and in merge working context _status initialization. The first can be fixed
with:

---
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2154,7 +2154,7 @@ def revert(ui, repo, *pats, **opts):
             names[abs] = (rel, exact)
             target_only[abs] = True
 
-        changes = repo.status(match=names.has_key)[:5]
+        changes = repo.status(files=names.keys())[:5]
         modified, added, removed, deleted, unknown = map(dict.fromkeys, changes)
 
         # if f is a rename, also revert the source
---

I ran the following test against linux-2.6 mirror with and without the patch:
- Append a character to a random file, call status, then revert the file
explicitely.
- Append a character to all files, call status, revert a single file, revert all
files.

I was afraid that "files" handling would be more expensive with larger
repositories and larger lists but revert timings were consistently better with
this patch.

The merge part looks harder to fix.
History
Date User Action Args
2007-12-09 18:28:28pmezardsetmessageid: <1197224908.12.0.683912681135.issue857@selenic.com>
2007-12-09 18:28:28pmezardsetrecipients: + mpm, jglick, jmr
2007-12-09 18:28:28pmezardlinkissue857 messages
2007-12-09 18:28:27pmezardcreate