Why is hg identify so slow?

Frank A. Kingswood frank at kingswood-consulting.co.uk
Wed Jun 25 11:52:28 CDT 2008


Frank A. Kingswood wrote:
> Shun-ichi GOTO wrote:
>>> I've noticed several times in the past that hg identify is quite slow
>>> compared to hg status. It would seem to me that hg identify actually has
>>> slightly less to do - no need to print out modified or unknown files.
>> If your repository has large number of revisions, it may hit  issue 557 / 548.
>> http://www.selenic.com/mercurial/bts/issue557
>> http://www.selenic.com/mercurial/bts/issue548
>>
>> In my case (issue 548), repository is emacs:
>> Here is a result on the repository:
> 
> Issue 557 suggests this is because of the number of tags.
> My repository has about 500 tags, and about 18K revisions.

As I was already doing a new conversion from CVS I've made sure that no 
tags were converted. Running the new repository (on a local filesystem) 
I still see hg identify (without --id) taking about twice as long as hg 
status or hg identify --id.

$ hg id --profile
f7ea19a4cb97 tip
          105031 function calls (104827 primitive calls) in 0.440 CPU 
seconds

    Ordered by: internal time, call count
    List reduced from 209 to 40 due to restriction <40>

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      1406    0.076    0.000    0.076    0.000 revlog.py:97(decompress)
         1    0.068    0.068    0.133    0.133 dirstate.py:515(findfiles)
        55    0.041    0.001    0.041    0.001 revlog.py:157(loadblock)
     20204    0.031    0.000    0.095    0.000 revlog.py:262(__getitem__)
     25046    0.030    0.000    0.030    0.000 struct.py:77(unpack)
         1    0.027    0.027    0.097    0.097 revlog.py:748(heads)
     10977    0.022    0.000    0.022    0.000 posixpath.py:56(join)
         1    0.014    0.014    0.174    0.174 dirstate.py:604(status)
        30    0.013    0.000    0.014    0.000 revlog.py:54(hash)
      4842    0.011    0.000    0.145    0.000 dirstate.py:455(statwalk)
      4841    0.009    0.000    0.020    0.000 dirstate.py:484(imatch)
      1406    0.009    0.000    0.102    0.000 revlog.py:872(chunk)
     41/24    0.009    0.000    0.016    0.001 demandimport.py:43(_load)
         1    0.008    0.008    0.015    0.015 dirstate.py:147(_read)
        30    0.008    0.000    0.145    0.005 revlog.py:922(revision)
      4841    0.007    0.000    0.010    0.000 match.py:11(__call__)
      4841    0.007    0.000    0.016    0.000 dirstate.py:426(_supported)
      4841    0.006    0.000    0.009    0.000 stat.py:54(S_ISREG)
     62/48    0.006    0.000    0.008    0.000 
demandimport.py:80(_demandimport)
       632    0.004    0.000    0.004    0.000 posixpath.py:373(normpath)
      1406    0.004    0.000    0.008    0.000 revlog.py:535(start)
      1406    0.003    0.000    0.007    0.000 revlog.py:539(length)
      4842    0.003    0.000    0.003    0.000 stat.py:29(S_IFMT)
      4841    0.003    0.000    0.003    0.000 match.py:33(<lambda>)
      5471    0.003    0.000    0.003    0.000 util.py:1256(pconvert)
        60    0.002    0.000    0.003    0.000 revlog.py:873(loadcache)
         6    0.002    0.000    0.002    0.000 revlog.py:182(findnode)
        15    0.002    0.000    0.003    0.000 manifest.py:58(_search)
       210    0.001    0.000    0.001    0.000 manifest.py:69(advance)
         1    0.001    0.001    0.001    0.001 socket.py:146(_socketobject)
        33    0.001    0.000    0.001    0.000 util.py:1501(__call__)
        41    0.000    0.000    0.000    0.000 demandimport.py:31(__init__)
    197/24    0.000    0.000    0.017    0.001 
demandimport.py:71(__getattribute__)
        15    0.000    0.000    0.143    0.010 manifest.py:98(find)
       630    0.000    0.000    0.000    0.000 util.py:262(never)
        15    0.000    0.000    0.007    0.000 changelog.py:138(read)
       630    0.000    0.000    0.000    0.000 match.py:18(dir)
       107    0.000    0.000    0.003    0.000 revlog.py:521(rev)
        55    0.000    0.000    0.041    0.001 revlog.py:227(loadindex)
         2    0.000    0.000    0.000    0.000 os.py:35(_get_exports_list)


$ hg id --id --profile
f7ea19a4cb97
          57495 function calls (57329 primitive calls) in 0.189 CPU seconds

    Ordered by: internal time, call count
    List reduced from 156 to 40 due to restriction <40>

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
         1    0.068    0.068    0.133    0.133 dirstate.py:515(findfiles)
     10948    0.022    0.000    0.022    0.000 posixpath.py:56(join)
         1    0.014    0.014    0.175    0.175 dirstate.py:604(status)
      4842    0.011    0.000    0.146    0.000 dirstate.py:455(statwalk)
      4841    0.009    0.000    0.020    0.000 dirstate.py:484(imatch)
         1    0.008    0.008    0.015    0.015 dirstate.py:147(_read)
      4841    0.007    0.000    0.010    0.000 match.py:11(__call__)
      4841    0.007    0.000    0.016    0.000 dirstate.py:426(_supported)
      4842    0.007    0.000    0.007    0.000 struct.py:77(unpack)
      4841    0.006    0.000    0.009    0.000 stat.py:54(S_ISREG)
     33/18    0.005    0.000    0.013    0.001 demandimport.py:43(_load)
     45/33    0.005    0.000    0.006    0.000 
demandimport.py:80(_demandimport)
       632    0.004    0.000    0.004    0.000 posixpath.py:373(normpath)
      4842    0.003    0.000    0.003    0.000 stat.py:29(S_IFMT)
      4841    0.003    0.000    0.003    0.000 match.py:33(<lambda>)
      5471    0.003    0.000    0.003    0.000 util.py:1256(pconvert)
         1    0.001    0.001    0.001    0.001 revlog.py:157(loadblock)
         1    0.001    0.001    0.001    0.001 socket.py:146(_socketobject)
        30    0.000    0.000    0.000    0.000 demandimport.py:31(__init__)
    157/18    0.000    0.000    0.013    0.001 
demandimport.py:71(__getattribute__)
       630    0.000    0.000    0.000    0.000 util.py:262(never)
       630    0.000    0.000    0.000    0.000 match.py:18(dir)
         2    0.000    0.000    0.000    0.000 os.py:35(_get_exports_list)
         1    0.000    0.000    0.001    0.001 revlog.py:11(<module>)
         1    0.000    0.000    0.005    0.005 socket.py:43(<module>)
         1    0.000    0.000    0.000    0.000 match.py:1(<module>)
         1    0.000    0.000    0.000    0.000 context.py:8(<module>)
         4    0.000    0.000    0.016    0.004 dirstate.py:27(__getattr__)
         1    0.000    0.000    0.000    0.000 revlog.py:119(__init__)
         4    0.000    0.000    0.000    0.000 util.py:1501(__call__)
         1    0.000    0.000    0.000    0.000 utf_8.py:8(<module>)
        15    0.000    0.000    0.000    0.000 <string>:1(<module>)
         1    0.000    0.000    0.002    0.002 revlog.py:442(__init__)
         1    0.000    0.000    0.182    0.182 localrepo.py:980(status)
         1    0.000    0.000    0.000    0.000 revlog.py:270(append)
         2    0.000    0.000    0.000    0.000 ui.py:379(write)
         4    0.000    0.000    0.000    0.000 util.py:725(__call__)
         1    0.000    0.000    0.000    0.000 ignore.py:27(ignore)
         1    0.000    0.000    0.189    0.189 commands.py:1423(identify)
         1    0.000    0.000    0.002    0.002 changelog.py:8(<module>)

Frank


More information about the Mercurial-devel mailing list