On Thu, 2018-01-18 at 21:03 +0900, Yuya Nishihara wrote: > On Wed, 17 Jan 2018 22:14:29 -0500, Jordi Gutiérrez Hermoso wrote: > > # HG changeset patch > > # User Jordi Gutiérrez Hermoso <jord...@octave.org> > > # Date 1516242948 18000 > > # Wed Jan 17 21:35:48 2018 -0500 > > # Node ID 701f8a9defdc09bb63f2596e2fc426f2e78da313 > > # Parent 0e369eca888fc80ee980fe8200c59dc7b0024dae > > templatekw: add utility function numrevs > > > > len(repo) calls incur noticeable overhead if called for each > > revision > > a template keyword is evaluated. > > Do you have some number? It's just a proxy to revlog.__len__(), so I > think it > is super fast.
The Python function calls leading up to it are not that fast. Without this caching, it takes 7.2 seconds on average on my machine to to do `hg log -T '{negrev}\n' > /dev/null`. With the caching, it takes 6.4 seconds on average. Not a huge difference, but a difference. I wanted to match the speed of `hg log -T '{rev}\n' > /dev/null`, and this caching helped me match it. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel