[issue3415] 'log --stat' is slow

Joshua Redstone bugs at mercurial.selenic.com
Tue May 1 09:27:42 CDT 2012


New submission from Joshua Redstone <redstone at gmail.com>:

As recently as changeset 038b389d80f5 (April 30th) and also with I think 
earlier versions of mercurial, 'hg log --stat' is pretty slow.  On a 
repository with >> 100k commits, doing 'hg log --stat -l 100' takes about 100 
seconds on my machine.

I sampled some python stack traces while it was running with:

pid=15563 ; ~/tmp/gdb-7.4/gdb/gdb --batch  ~/tmp/Python-2.7.3/python -ex "py-
bt" $pid | grep -v 'Thread debugging' | grep -v 'Using host libthread' | awk 
'/mercurial\/util.py.*in check/ { print "[ Omitting higher generic frames ]"; 
exit; } { print substr($0, 0, 120) }'

and it looks like hg is generating manifests for a pair of revisions for each 
commit and then doing some kind of set difference on that.  It looks set the 
set difference code is the slow part (e.g., localrepo.py:1426 at rev 
038b389d80f5).  One way to speed that up may be to special-case the code for 
comparing two revisions where one is the ancestor of another to not 
materialize manifests and instead look directly at the entry in the manifest 
log for the corresponding commit.  Another possibility may be to recode in C.

----------
messages: 19837
nosy: redstone
priority: wish
status: unread
title: 'log --stat'  is slow

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue3415>
____________________________________________________


More information about the Mercurial-devel mailing list