This is an archive of the discontinued Mercurial Phabricator instance.

perf: add a command to benchmark linelog edits

Authored by quark on Aug 6 2018, 9:59 PM.



The use pattern of creating a linelog is usually by calling "replacelines"
multiple times. Add a command to benchmark it.

Diff Detail

rHG Mercurial
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

quark created this revision.Aug 6 2018, 9:59 PM
quark updated this revision to Diff 10061.Aug 7 2018, 12:01 PM
indygreg added inline comments.

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?

quark added inline comments.Aug 7 2018, 8:15 PM

I think random.seed(0) makes it stable?

Good point about pre-calculate randints. Will change.

quark updated this revision to Diff 10065.Aug 7 2018, 8:22 PM
durin42 accepted this revision.Aug 9 2018, 1:53 PM
durin42 added a subscriber: durin42.

I'm confident the random.seed(0) gives us the stability between runs we're concerned about.

This revision is now accepted and ready to land.Aug 9 2018, 1:53 PM
This revision was automatically updated to reflect the committed changes.