Commit Graph

46 Commits

Author SHA1 Message Date
Yuya Nishihara
9757d7bd19 py3: make contrib/revsetbenchmarks.py not import symbols from stdlib modules 2016-05-14 14:23:04 +09:00
Pulkit Goyal
4650b402b2 contrib: revsetbenchmarks use absolute_import and print_function 2016-03-16 04:35:03 +05:30
Durham Goode
e072959d9e revsetbenchmark: handle exception case
If the revset being benchmarked has an exception, the handling code was
encountering an error because the exception did not always have an "output"
attribute (I think it's a python 2.7 thing).
2016-02-10 12:39:25 -08:00
Gregory Szorc
8577d931d0 revsetbenchmarks: support benchmarking changectx loading
Many revset consumers construct changectx instances for each returned
result. Add support for benchmarking this to our revset benchmark
script.

In the future, we might want to have some kind of special syntax in
the parsed revset files to engage this mode automatically. This would
enable us to load changectxs for revsets that do that in the code and
would more accurately benchmark what's actually happening. For now,
running all revsets with or without changectxs is sufficient.
2015-11-21 15:43:04 -08:00
Mads Kiilerich
09567db49a spelling: trivial spell checking 2015-10-17 00:58:46 +02:00
Yuya Nishihara
da13a040c4 revsetbenchmarks: run make after update so that C extensions are built 2015-08-15 17:50:59 +09:00
Gregory Szorc
5380dea2a7 global: mass rewrite to use modern exception syntax
Python 2.6 introduced the "except type as instance" syntax, replacing
the "except type, instance" syntax that came before. Python 3 dropped
support for the latter syntax. Since we no longer support Python 2.4 or
2.5, we have no need to continue supporting the "except type, instance".

This patch mass rewrites the exception syntax to be Python 2.6+ and
Python 3 compatible.

This patch was produced by running `2to3 -f except -w -n .`.
2015-06-23 22:20:08 -07:00
Pierre-Yves David
7a8996fad4 revsetbenchmark: do not abort on failure to run a revset
Instead of aborting the whole process, we just skip entry for revset that
failed to run.
2015-06-20 16:22:10 -07:00
Pierre-Yves David
0b5134f913 revsetbenchmarks: ignore empty lines
Before this change, empty lines were seen as an entry and the benchmark tried
to run benchmark for "".
2015-06-20 04:13:25 -07:00
Pierre-Yves David
254ba0361d revsetbenchmarks: add main documention for the script
This allow us to document the fact we can use comment in the file listing revsets.
2015-06-16 20:24:37 -07:00
Pierre-Yves David
a58cb283b6 revsetbenchmarks: also display tag when printing a revision
This is usually more useful information than the commit message.
2015-06-10 17:33:57 -07:00
Pierre-Yves David
4bf2a1c663 revsetbenchmarks: use combination variants in default set
Now that we have them, let's make use of them.
2015-06-09 23:49:07 -07:00
Pierre-Yves David
1a88814277 revsetbenchmarks: support combining variants with "+"
We need more advanced variants in some cases. For example, "The last
rev of the sorted version".

We introduce a syntax for this: `reverse+last` means `last(reverse(REVSET))`.
2015-06-09 23:45:34 -07:00
Pierre-Yves David
6f731a872c revsetbenchmarks: use many more variants by default
So far the variants feature was introduced, but not used by
default. We now use a set of basic variants by default.
2015-06-09 21:10:44 -07:00
Pierre-Yves David
3e785ae2da revsetbenchmarks: display even more compact timing result
We now use an 8 char display for timing (from 10), we add some logic to drop
precision if the number grows too large (as we do not care about sub-0 digit
in this case). This allow to pack more variants in a single screen.
2015-06-09 21:20:54 -07:00
Pierre-Yves David
abd025e2f3 revsetbenchmarks: allow running multiple variants per revset
The current benchmarks were only testing the whole iteration. This is suboptimal
because some changes are meaningful for things like first result, minimum or
sorting.

We introduce a "variants" feature that let you systematically add some variants
to all revsets tested.

A typical variants value would be 'plain,min,last,sort'. When testing 'all()' it
will also provide testing for:
- all()
- min(all())
- last(all())
- sort(sort)

and output:

   plain         min            last           sort
0) 0.034568      0.037857       0.000074       0.034238
1) 0.011358  32% 0.020181  53%  0.000080 108%  0.011405  33%

Using revsets (who hit the API) instead of the internal API add some overhead,
but the overhead should be the same everywhere so it still allow comparison.
This is is more simple to implement and allows comparison with older versions
who do not have the same API.
2014-10-27 11:59:39 +01:00
Pierre-Yves David
dd891bab9c revsetbenchmarks: display relative change when meaningful
If the time difference is more than 5% from the previous run, we'll display
relative information. This makes it much simpler to spot performance changes in
a sea of benchmarks.
2015-06-09 21:30:04 -07:00
Pierre-Yves David
c7c66491f5 revsetbenchmarks: improve revision printing
We now print the revision number and short hash inline. As a result we drop the
crappy list printing.
2015-06-09 18:53:04 -07:00
Pierre-Yves David
e5f0537065 revsetbenchmarks: hide most timing under a --verbose flag
We mostly only care about total time. Dropping this output give us some room to
display more useful information (like percentage different) in future
changesets.
2015-06-09 18:40:06 -07:00
Pierre-Yves David
f130bcfaa1 revsetbenchmarks: drop outdated comment
We are no longer testing against system mercurial for quite some time.
2015-06-09 18:32:47 -07:00
Pierre-Yves David
d6c409833b revsetbenchmarks: fix argument parsing
The file doc was saying something, the code was doing something else, the
argument validation was doing a third thing.

Doc and behavior now comply with the argument defined in the code.
2015-06-09 18:39:55 -07:00
Pierre-Yves David
3f8df9e038 revsetbenchmarks: use a more compact output format with a header
We change the output from:

  revset #0: draft()
  0) wall 0.011989 comb 0.010000 user 0.000000 sys 0.010000 (best of 177)
  1) wall 0.012226 comb 0.010000 user 0.000000 sys 0.010000 (best of 193)
  2) wall 0.011838 comb 0.020000 user 0.000000 sys 0.020000 (best of 208)

to:

  revset #0: draft()
       wall       comb       user       sys       count
  0)   0.012028   0.010000   0.000000   0.010000    170
  1)   0.012218   0.010000   0.000000   0.010000    157
  2)   0.012622   0.010000   0.000000   0.010000    189

This opens the road to more useful output.
2015-06-09 17:15:48 -07:00
Augie Fackler
ada9978856 revsetbenchmarks: clarify comment based on irc discussion 2015-06-12 16:42:07 -04:00
Pierre-Yves David
59a81fd7b3 revsetbenchmarks: ensure all indexes have the same width
This avoids an alignment glitch.
2015-06-11 10:55:02 -07:00
Pierre-Yves David
1cc4521b8c revsetbenchmarks: factor out result output into a function
This will make update of the output easier.
2015-06-09 16:57:18 -07:00
Pierre-Yves David
db08ff2e74 revsetbenchmarks: parse perfrevset output into actual number
We cannot just ask perfrevset to provide debug output because we usually want
to compare output from old version of Mercurial that do not support it. So, we
are using a regular expression.

(/we now have \d problems/).
2015-06-09 16:48:29 -07:00
Pierre-Yves David
bb398f89a5 revsetbenchmarks: improve error output in case of failure
This helps with diagnostics.
2015-06-09 15:58:48 -07:00
Pierre-Yves David
d9d7ac3a22 revsetbenchmarks: extract call to mercurial into a function
This is a gratuitous change to make the code easier to look at.
2015-06-09 15:49:14 -07:00
Mads Kiilerich
523c87c1fe spelling: fixes from proofreading of spell checker issues 2014-04-17 22:47:38 +02:00
Pierre-Yves David
a74e4ee649 revsetbenchmark: allow comments ('#' prefix) in the revset input 2014-09-23 17:09:19 -07:00
Pierre-Yves David
250b8754d7 revsetbenchmark: make it clear that revsets may be read from stdin 2014-09-23 17:08:49 -07:00
Matt Mackall
7cba48bf37 whitespace: nuke triple blank lines in **.py 2014-08-07 14:58:12 -05:00
Pierre-Yves David
c15a68e583 revsetbenchmark: support for running on other repo
We add a -R/--repo option to run the benchmarks on another repository. This is
very useful as some repository are bigger/more interesting  than the mercurial one.
2014-04-29 14:12:32 -07:00
Pierre-Yves David
aef1228e4b revsetbenchmark: automatically finds the perf extension
Before this changeset, you had to stand in the root of the mercurial repo to run
the `revsetbenchmark.py` script. Otherwise, the perf extension would not be
found a `./contrib/perf.py` and the script would crash in panic.

We now figure out the contrib directory from the location of this script. This
makes it possible to run the script from other location that the mercurial repo
root (but you still need to be in the core mercurial repository)
2014-04-29 13:18:22 -07:00
Pierre-Yves David
3e36aa9f14 revsetbenchmark: use optparse to retrieve argument
We need more flexibility. For example we'll want to run the benchmark on other
repository.
2014-04-29 11:40:42 -07:00
Pierre-Yves David
5909fe016c revsetbenchmark: add a usage message when no arguments are passed
This increase the odd someone who didn't wrote will it find out how to use this
script.
2014-04-25 13:35:31 -07:00
Pierre-Yves David
34283e2be8 revsetbenchmark: fix error raising
We want to display the commands, not all arguments of the function. (The old
code actually crash, failing to joining a list of lists.)
2014-04-25 13:44:51 -07:00
Durham Goode
af886934bd revsetbenchmark: remove python 2.7 dependency
revsetbenchmark.py used check_output which only exists in python 2.7. This
fixes it.
2014-03-31 16:29:39 -07:00
Pierre-Yves David
2df0f51a30 revsetbenchmark: add a summary at the end of execution
The summary list timing per revset making it much more easier to compare
revision to each other.
2014-03-26 18:51:49 -07:00
Pierre-Yves David
63b573d0ad revsetbenchmark: retrieve the benchmark value in python
We retrieve the output of the perf extension and print it ourself. This open the
door to processing of this data in the script.
2014-03-26 18:39:56 -07:00
Pierre-Yves David
b9be167079 revsetbenchmark: get revision to benchmark in a function
And move it to proper subprocess call.
2014-03-26 18:36:19 -07:00
Pierre-Yves David
9aaf552368 revsetbenchmark: convert revision display to proper subprocesscall 2014-03-26 18:27:17 -07:00
Pierre-Yves David
9af19c7201 revsetbenchmark: convert performance call to proper subprocess call 2014-03-26 18:26:18 -07:00
Pierre-Yves David
2214b66655 revsetbenchmark: convert update to proper subprocess call 2014-03-26 18:14:15 -07:00
Matt Mackall
cf6b799f9a revsetbenchmark: fix semicolon 2014-03-27 16:52:24 -05:00
Pierre-Yves David
05c4763edb revsetbenchmark: simplify and convert the script to python
The script is now in python. That translation is very raw, more improvement to
comes:

The "current code" and "base" entry have been dropped.  This is trivial to get
same result using a tagged revision or "." in the list of benchmarked revision.
2014-03-26 18:03:30 -07:00