Commit Graph

96 Commits

Author SHA1 Message Date
Pavol Vaskovic
0d64386b53 [benchmark] Documentation improvements
Improving complience with
PEP 257 -- Docstring Conventions
https://www.python.org/dev/peps/pep-0257/
2018-08-23 11:45:43 +02:00
Pavol Vaskovic
f38e6df914 [benchmark] Doctor verifies constant memory use
This needs to be finished with function approximating normal range based on the memory used.
2018-08-20 16:52:07 +02:00
Pavol Vaskovic
06061976da [benchmark] BenchmarkDoctor checks setup overhead
Detect setup overhead in benchmark and report if it exceeds 5%.
2018-08-17 08:50:04 +02:00
Pavol Vaskovic
7725c0096e [benchmark] Measure and analyze benchmark runtimes
`BenchmarkDoctor` measures benchmark execution (using `BenchmarkDriver`) and verifies that their runtime stays under 2500 microseconds.
2018-08-17 08:40:39 +02:00
Pavol Vaskovic
ab16999e20 [benchmark] Created BenchmarkDoctor (naming)
`BenchmarkDoctor` analyzes performance tests and reports their conformance to the set of desired criteria. First two rules verify the naming convention.

`BenchmarkDoctor` is invoked from `Benchmark_Driver` with `check` aurgument.
2018-08-17 08:40:39 +02:00
Pavol Vaskovic
076415f969 [benchmark] Strangler run_benchmarks
Replaced guts of the `run_benchmarks` function with implementation from `BenchmarDriver`. There was only single client which called it with `verbose=True`, so this parameter could be safely removed.

Function `instrument_test` is replaced by running the `Benchmark_0` with `--memory` option, which implements the MAX_RSS measurement while also excluding the overhead from the benchmarking infrastructure. The incorrect computation of standard deviation was simply dropped for measurements of more than one independent sample. Bogus aggregated `Totals` statistics were removed, now reporting only the total number of executed benchmarks.
2018-08-17 08:40:39 +02:00
Pavol Vaskovic
a84db83062 [benchmark] BenchmarkDriver can run tests
The `run` method on `BenchmarkDriver` invokes the test harness with specified number of iterations, samples. It supports mesuring memory use and in the verbose mode it also collects individual samples and monitors the system load by counting the number of voluntary and involuntary context switches.

Output is parsed using `LogParser` from `compare_perf_tests.py`. This makes that file a required dependency for the driver, therefore it is also copied to the bin directory during the build.
2018-08-17 08:39:50 +02:00
Pavol Vaskovic
ce39b12929 [benchmark] Strangler: BenchmarkDriver get_tests
See https://www.martinfowler.com/bliki/StranglerApplication.html for more info on the used pattern for refactoring legacy applications.

Introduced class `BenchmarkDriver` as a beginning of strangler application that will gradually replace old functions. Used it instead of `get_tests()` function in Benchmark_Driver.

The interaction with Benchmark_O is simulated through mocking. `SubprocessMock` class records the invocations of command line processes and responds with canned replies in the format of Benchmark_O output.

Removed 3 redundant lit tests that are now covered by the unit test `test_gets_list_of_all_benchmarks_when_benchmarks_args_exist`. This saves 3 seconds from test execution. Keeping only single integration test that verifies that the plumbing is connected correstly.
2018-08-17 00:32:04 +02:00
Pavol Vaskovic
69d5d5e732 [benchmark] Adding tests for BenchmarkDriver
The imports are a bit sketchy because it doesn’t have `.py` extension and they had to be hacked manually. :-/

Extracted `parse_args` from `main` and added test coverage for argument parsing.
2018-08-17 00:32:04 +02:00
Pavol Vaskovic
343f284227 [benchmark] Removed legacy submit command
Also removed inused imports.
2018-08-16 20:08:34 +02:00
Pavol Vaskovic
7f894268b2 [benchmark] Restore running benchmarks by numbers
Reintroduced feature lost during `BenchmarkInfo` modernization: All registered benchmarks are ordered alphabetically and assigned an index. This number can be used as a shortcut to invoke the test instead of its full name. (Adding and removing tests from the suite will naturally reassign the indices, but they are stable for a given build.)

The `--list` parameter now prints the test *number*, *name* and *tags* separated by delimiter.

The `--list` output format is modified from:
````
Enabled Tests,Tags
AngryPhonebook,[String, api, validation]
...
````
to this:
````
\#,Test,[Tags]
2,AngryPhonebook,[String, api, validation]
…
````
(There isn’t a backslash before the #, git was eating the whole line without it.)
Note: Test number 1 is Ackermann, which is marked as “skip”, so it’s not listed with the default `skip-tags` value.

Fixes the issue where running tests via `Benchmark_Driver` always reported each test as number 1. Each test is run independently, therefore every invocation was “first”. Restoring test numbers resolves this issue back to original state: The number reported in the first column when executing the tests is its ordinal number in the Swift Benchmark Suite.
2018-07-11 23:17:02 +02:00
Pavol Vaskovic
d82c996669 [benchmark] Fixed Benchmark_Driver running tests
Fixed failure in `get_tests` which depended on the removed `Benchmark_O --run-all` option for listing all test (not just the pre-commit set).

Fix: Restored the ability to run tests by ordinal number from `Benchmark_Driver` after the support for this was removed from `Benchmark_O`.

Added tests that verify output format of `Benchmark_O --list` and the support for `--skip-tags= ` option which effectively replaced the old `--run-all` option. Other tools, like `Benchmark_Driver` depend on it.
Added integration tests for the dependency between `Benchmark_Driver` and `Benchmark_O`.

Running pre-commit test set isn’t tested explicitly here. It would take too long and it is run fairly frequently by CI bots, so if that breaks, we’ll know soon enough.
2018-07-11 23:17:02 +02:00
Karoy Lorentey
11515c1676 [benchmark] Driver: stabilize Dictionary/Set benchmarks
Disable the random hash seed while benchmarking. By its nature, it makes the number of hash collisions fluctuate between runs, adding unnecessary noise to benchmark results.

I expect we'll be able to re-enable random seeding here once we have made hash collisions cheaper -- they are currently always resolved by calling the Key's Equatable implementation, which can be expensive.
2018-03-19 17:38:29 +00:00
Erik Eckstein
45a2ae48ce benchmarks: replace the Ounchecked build with an Osize build
We don't measure Ounchecked anymore. On the other hand we want to benchmark the Osize build.
2017-10-06 14:09:43 -07:00
Michael Gottesman
dfc780a744 [benchmark][driver] Teach the Benchmark_Driver how to parse ./Benchmark_O{,none} --list now that tags are output as well. 2017-09-27 19:14:52 -07:00
Pavol Vaskovic
9c51a48917 Fix: Run benchmarks just once 2017-06-27 18:47:35 +02:00
Luke Larson
6944c20e13 Benchmark_Driver: Support custom baseline branches
Support specifying a baseline branch to compare the current results
against. Previously, the master branch was hardcoded.

Fixes: rdar://problem/32751587
2017-06-14 15:28:52 -07:00
Pavol Vaskovic
97d6f8dc5e Support for running benchmarks by ordinal number
Add support for running benchmarks by reffering to them by their ordinal number in `Benchmark_Driver`, as is supported by `Benchmark_O`(`Onone`, `Ounchecked`).

Updated documentation to reflect this.
2017-06-12 20:50:00 +02:00
Pavol Vaskovic
f244b54e68 Fix SR-4780
SR-4780 Can not run performance tests that are not in precommit suite

Modified driver to honor command line arguments when listing enabled tests. Fixed interaction between filters (positional arguments) and --run-all option.

Benchmark_Driver lists available benchmarks with --run-all option when benchmarks or filters are specified.
2017-06-07 21:13:50 +02:00
Mishal Shah
a05b35c332 Merge pull request #9026 from palimondo/SR-4598
[benchmark] Support multiple regular expression filters in Benchmark_Driver
2017-05-05 09:46:02 -07:00
Pavol Vaskovic
2f8f11801a Filters are now regullar expression patterns 2017-05-05 08:48:41 +02:00
swift-ci
ba67a51c54 Merge pull request #8978 from palimondo/SR-4659 2017-04-27 14:53:26 -07:00
Pavol Vaskovic
d77324782a Fix SR-4659 Benchmark logs should be tied to tested tree version 2017-04-27 23:09:14 +02:00
Pavol Vaskovic
6d9de4ca70 Multiple filters are specified by repeated -f
Updated usage documentation to reflect this.
2017-04-26 21:12:59 +02:00
Pavol Vaskovic
481f542100 Support multiple prefix filters 2017-04-26 16:14:59 +02:00
Pavol Vaskovic
cecfe439c6 Display OPT choices in usage help
Fixed pyton-lint warnings
2017-04-25 03:50:40 +02:00
Pavol Vaskovic
5c29fa65b1 Renamed args.benchmarks - plural 2017-04-25 03:25:29 +02:00
Pavol Vaskovic
094094a04c Addressed python style issue raised during review 2017-04-24 23:53:40 +02:00
Pavol Vaskovic
3a5051e392 Fix SR-4598 Add option to run subset of benchmarks matching a prefix 2017-04-24 23:40:38 +02:00
Hugh Bellamy
8671854674 Properly python lint remaining files 2017-03-23 14:06:46 +07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Mishal Shah
cb23837bb9 [Compare Perf] Add support for markdown and html 2016-03-21 18:08:08 -07:00
practicalswift
1edb62dc38 [Python] Make flake8 linting pass without errors/warning (w/ default rules) 2016-03-13 20:19:51 +01:00
practicalswift
30b66ea036 Merge pull request #1584 from practicalswift/python-3-compatible-print
[Python] Use Py3k compatible print operator: print "foo" → print("foo")
2016-03-09 08:00:49 +01:00
Brian Gesiak
c9000af795 Merge pull request #1526 from practicalswift/fix-pep8-violations-ii
[Python] Fix five classes of PEP-8 violations (E101/E111/E128/E302/W191)
2016-03-08 23:55:46 -05:00
practicalswift
0fd0c48648 [Python] Use Py3k compatible print operator: print "foo" → print("foo") 2016-03-08 23:10:52 +01:00
practicalswift
e2de5c2202 [Python] Fix blind except: statements
Make sure all Python code in the repo specifies which exceptions to
catch when using `except:`.

Regressions can be catched using `flake8-blind-except` going forward.
2016-03-08 11:08:28 +01:00
practicalswift
265835fdfc [Python] Use consistent import ordering for Python code
Ordering used:
1.) standard library imports
2.) third party imports
3.) local package imports

Each group is individually alphabetized.
2016-03-07 23:25:16 +01:00
practicalswift
183da818df [Python] Fix five classes of PEP-8 violations (E101/E111/E128/E302/W191)
* E101: indentation contains mixed spaces and tabs
* E111: indentation is not a multiple of four
* E128: continuation line under-indented for visual indent
* E302: expected 2 blank lines, found 1
* W191: indentation contains tabs
2016-03-07 22:36:23 +01:00
Karoly Lorentey
d921b4e1bc [benchmark][SR-871] Convert duration strings to integers before calculating min/max
Benchmark_Driver used string comparison to calculate the minimum and maximum
of durations in benchmark results, sometimes leading to wildly inaccurate reports.
2016-03-03 22:34:54 +01:00
practicalswift
e33f1747a9 [Python] Improve Python consistency: "variable in function should be lowercase" (N806)
The repo contains roughly 80 Python scripts. "snake_case" naming is used for
local variables in all those scripts. This is the form recommended by the PEP 8
naming recommendations (Python Software Foundation) and typically associated
with idiomatic Python code.

However, in nine of the 80 scripts there were at least one instance of
"camelCase" naming prior to this commit.

This commit improves consistency in the Python code base by making sure that
these nine remaining files follow the variable naming convention used for
Python code in the project.

References:
* PEP 8: https://www.python.org/dev/peps/pep-0008/
* pep8-naming: https://pypi.python.org/pypi/pep8-naming
2016-03-02 18:56:47 +01:00
practicalswift
f6d6585ee0 [Python] Improve Python consistency: Use function_name(…) throughout (PEP8) 2016-02-29 22:49:19 +01:00
practicalswift
e395ea0f0e [Python] Follow standard Python docstrings conventions (PEP-0257).
https://www.python.org/dev/peps/pep-0257/
2016-02-20 17:11:57 +01:00
practicalswift
a7cbdb4ea5 Bring new Python code in line with subset of PEP 8 used in project. 2016-02-08 20:42:19 +01:00
Luke Larson
0356ec8ec3 Add Swift Benchmark Suite 2016-02-08 10:47:58 -08:00