Mercurial > hg
comparison mercurial/ancestor.py @ 34306:bd50aa1aa035
alias: make alias command lazily resolved
With many aliases, resolving them could have some visible overhead. Below is
part of traceprof [1] output of `hg bookmark --hidden`:
(time unit: ms)
37 \ addaliases dispatch.py:526
37 | __init__ (60 times) dispatch.py:402
33 | findcmd (108 times) cmdutil.py:721
16 | findpossible (49 times) cmdutil.py:683
It may get better by optimizing `findcmd` to do a bisect, but we don't
really need to resolve an alias if it's not used, so let's make those
command entries lazy.
After this patch, `addalias` takes less than 1ms.
.. perf:: improved performance when many aliases are defined
[1]: https://bitbucket.org/facebook/hg-experimental/src/9aca0dbdbdfc48457e5d2581ca2d6e662fced2e6/hgext3rd/traceprof.pyx
Differential Revision: https://phab.mercurial-scm.org/D805
author | Jun Wu <quark@fb.com> |
---|---|
date | Sat, 23 Sep 2017 13:46:12 -0700 |
parents | bd872f64a8ba |
children | f8b46245b26a |
comparison
equal
deleted
inserted
replaced
34305:0e48813cc106 | 34306:bd50aa1aa035 |
---|