On Mon, Feb 13, 2017 at 10:00:25AM -0800, Bryan O'Sullivan wrote:
> On Mon, Feb 13, 2017 at 9:29 AM, Simon Farnsworth <simon...@fb.com> wrote:
>
> > The perfwrite microbenchmark shifts to:
> > Linux:
> > ! wall 3.316087 comb 0.900000 user 0.810000 sys 0.090000 (best of 3)
> > Mac:
> > ! wall 0.939282 comb 0.580000 user 0.470000 sys 0.110000 (best of 8)
> >
> > If I open-code timings in ui.write instead of using the context manager, I
> > see:
> > Linux:
> > ! wall 3.478070 comb 0.500000 user 0.420000 sys 0.080000 (best of 3)
> > Mac:
> > ! wall 0.218112 comb 0.220000 user 0.150000 sys 0.070000 (best of 15)
> >
> >
> Thanks for adding this data. (For future reference, it's good to include an
> analysis of the difference instead of just the plain numbers, as I have to
> flip back and forth between two emails and memorize the numbers to do the
> comparison in my head.)
>
> These numbers suggest to me that open-coding the performance measurement is
> the right thing to do for ui.write and ui.flush.

+1 on open-coding for perf reasons, maybe make a comment to that
effect so future optimizers don't get overeager.

>
> Here's why.
>
> First, let's discount the wall time, as this number is so noisy as to make
> no sense. For example, if you compare the uninstrumented code with the
> numbers above, you'll see that wall time has *dropped* by 30% or so on OSX,
> even though we're doing more work. This is a good object lesson in why
> contrib/perf.py is very far from a trustworthy benchmarking tool :-)
>
> If you look instead at the somewhat less suspect "comb" time (user+system
> combined), you'll see that it more than doubles under the context manager,
> vs a smallish bump with open coding of the measurements.
>
> With its fancy templating and colour support, Mercurial is already
> surprisingly slow at simply writing to stdout, an activity that is
> obviously on the critical path for many uses. I believe it's worth the few
> extra lines of code to keep the lowest-level part of this as fast as
> possible.

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to