D4148: perf: add a command to benchmark linelog edits

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Tue Aug 7 19:33:18 EDT 2018


indygreg added inline comments.

INLINE COMMENTS

> perf.py:904-912
> +        random.seed(0)
> +        randint = random.randint
> +        currentlines = 0
> +        ll = linelog.linelog()
> +        for rev in xrange(edits):
> +            a1 = randint(0, currentlines)
> +            a2 = randint(a1, min(currentlines, a1 + maxhunklines))

I'm a bit concerned about the use of random data in a benchmark. Since every run will be different, the benchmark may not be stable. And if the random source is slow, we could be spending time waiting on entropy.

Do you think it is worthwhile to precompute the arguments to `replacelines()` and have the benchmark simply iterate through a list of arguments and call `replacelines()` repeatedly?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4148

To: quark, #hg-reviewers
Cc: indygreg, mercurial-devel


More information about the Mercurial-devel mailing list