Reducing startup time

Martin Geisler mg at daimi.au.dk
Mon Feb 2 19:51:45 UTC 2009


Matt Mackall <mpm at selenic.com> writes:

> On Mon, 2009-02-02 at 09:47 +0100, Martin Geisler wrote:
>> Matt Mackall <mpm at selenic.com> writes:
>> 
>> > On Mon, 2009-02-02 at 00:48 +0100, Martin Geisler wrote:
>> >> Hi,
>> >> 
>> >> Brendan and I discussed on IRC how we can avoid doing several hundred
>> >> translations on every startup, even when hg makes no output.
>> >
>> > Bleck.
>> >
>> > I've yet to see anything to convince me that it's the translation of
>> > individual strings that is the problem.
>> 
>> I haven't benchmarked it, but it just feels wastefull to me :-)
>
> Oh, sure it's wasteful. But if there's not a measurable cost, we
> shouldn't break our tools to work around it.
>
> What does hg perfstartup say (contrib/perf.py)? 

Amazing! I tried removing the calls to _() in commands.py and in all the
cmdtables of these extensions (which are the ones I have enabled):

  bookmarks, churn, convert, graphlog, hgk, highlight, mq, patchbomb,
  rebase, record, transplant,

The time with the _() calls:

% hg perfstartup
! wall 0.074170 comb 0.010000 user 0.000000 sys 0.010000 (best of 100)

and the time without any _() calls:

% hg perfstartup
! wall 0.072893 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)

We're talking about 205 calls to _(), done in less than 2 ms! I thought
they would be more expensive.

So you were right -- no need to complicate things here :-)

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20090202/fd3a5488/attachment.asc>


More information about the Mercurial-devel mailing list