From ecf2a9ee727b61ad52e9ba74cae1717c9cbd315d Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Mon, 13 Aug 2018 07:48:55 -0700 Subject: [PATCH 01/30] add airspeed velocity config and tests --- asv_bench/asv.conf.json | 147 +++++++++++++++++++++++++ asv_bench/benchmarks/__init__.py | 1 + asv_bench/benchmarks/location.py | 20 ++++ asv_bench/benchmarks/solarposition.py | 23 ++++ docs/sphinx/source/whatsnew/v0.6.0.rst | 2 + 5 files changed, 193 insertions(+) create mode 100644 asv_bench/asv.conf.json create mode 100644 asv_bench/benchmarks/__init__.py create mode 100644 asv_bench/benchmarks/location.py create mode 100644 asv_bench/benchmarks/solarposition.py diff --git a/asv_bench/asv.conf.json b/asv_bench/asv.conf.json new file mode 100644 index 0000000000..ec7050a41b --- /dev/null +++ b/asv_bench/asv.conf.json @@ -0,0 +1,147 @@ +{ + // The version of the config file format. Do not change, unless + // you know what you are doing. + "version": 1, + + // The name of the project being benchmarked + "project": "pvlib python", + + // The project's homepage + "project_url": "https://github.com/pvlib/pvlib-python", + + // The URL or local path of the source code repository for the + // project being benchmarked + "repo": "..", + + // List of branches to benchmark. If not provided, defaults to "master" + // (for git) or "default" (for mercurial). + // "branches": ["master"], // for git + // "branches": ["default"], // for mercurial + + // The DVCS being used. If not set, it will be automatically + // determined from "repo" by looking at the protocol in the URL + // (if remote), or by looking for special directories, such as + // ".git" (if local). + "dvcs": "git", + + // The tool to use to create environments. May be "conda", + // "virtualenv" or other value depending on the plugins in use. + // If missing or the empty string, the tool will be automatically + // determined by looking for tools on the PATH environment + // variable. + "environment_type": "conda", + + // timeout in seconds for installing any dependencies in environment + // defaults to 10 min + //"install_timeout": 600, + + // the base URL to show a commit for the project. + // "show_commit_url": "http://github.com/pvlib/pvlib-python/commit/", + + // The Pythons you'd like to test against. If not provided, defaults + // to the current version of Python used to run `asv`. + // "pythons": ["2.7", "3.7"], + + // The matrix of dependencies to test. Each key is the name of a + // package (in PyPI) and the values are version numbers. An empty + // list or empty string indicates to just test against the default + // (latest) version. null indicates that the package is to not be + // installed. If the package to be tested is only available from + // PyPi, and the 'environment_type' is conda, then you can preface + // the package name by 'pip+', and the package will be installed via + // pip (with all the conda available packages installed first, + // followed by the pip installed packages). + // + // "matrix": { + // "numpy": ["1.6", "1.7"], + // "six": ["", null], // test with and without six installed + // "pip+emcee": [""], // emcee is only available for install with pip. + // }, + "matrix": { + "numpy": [""], + "pandas": [""], + "bottleneck": [""], + "numexpr": [""] + }, + + // Combinations of libraries/python versions can be excluded/included + // from the set to test. Each entry is a dictionary containing additional + // key-value pairs to include/exclude. + // + // An exclude entry excludes entries where all values match. The + // values are regexps that should match the whole string. + // + // An include entry adds an environment. Only the packages listed + // are installed. The 'python' key is required. The exclude rules + // do not apply to includes. + // + // In addition to package names, the following keys are available: + // + // - python + // Python version, as in the *pythons* variable above. + // - environment_type + // Environment type, as above. + // - sys_platform + // Platform, as in sys.platform. Possible values for the common + // cases: 'linux2', 'win32', 'cygwin', 'darwin'. + // + // "exclude": [ + // {"python": "3.2", "sys_platform": "win32"}, // skip py3.2 on windows + // {"environment_type": "conda", "six": null}, // don't run without six on conda + // ], + // + // "include": [ + // // additional env for python2.7 + // {"python": "2.7", "numpy": "1.8"}, + // // additional env if run on windows+conda + // {"platform": "win32", "environment_type": "conda", "python": "2.7", "libpython": ""}, + // ], + + // The directory (relative to the current directory) that benchmarks are + // stored in. If not provided, defaults to "benchmarks" + "benchmark_dir": "benchmarks", + + // The directory (relative to the current directory) to cache the Python + // environments in. If not provided, defaults to "env" + "env_dir": ".asv/env", + + // The directory (relative to the current directory) that raw benchmark + // results are stored in. If not provided, defaults to "results". + "results_dir": ".asv/results", + + // The directory (relative to the current directory) that the html tree + // should be written to. If not provided, defaults to "html". + "html_dir": ".asv/html", + + // The number of characters to retain in the commit hashes. + // "hash_length": 8, + + // `asv` will cache wheels of the recent builds in each + // environment, making them faster to install next time. This is + // number of builds to keep, per environment. + // "wheel_cache_size": 0 + + // The commits after which the regression search in `asv publish` + // should start looking for regressions. Dictionary whose keys are + // regexps matching to benchmark names, and values corresponding to + // the commit (exclusive) after which to start looking for + // regressions. The default is to start from the first commit + // with results. If the commit is `null`, regression detection is + // skipped for the matching benchmark. + // + // "regressions_first_commits": { + // "some_benchmark": "352cdf", // Consider regressions only after this commit + // "another_benchmark": null, // Skip regression detection altogether + // } + + // The thresholds for relative change in results, after which `asv + // publish` starts reporting regressions. Dictionary of the same + // form as in ``regressions_first_commits``, with values + // indicating the thresholds. If multiple entries match, the + // maximum is taken. If no entry matches, the default is 5%. + // + // "regressions_thresholds": { + // "some_benchmark": 0.01, // Threshold of 1% + // "another_benchmark": 0.5, // Threshold of 50% + // } +} diff --git a/asv_bench/benchmarks/__init__.py b/asv_bench/benchmarks/__init__.py new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/asv_bench/benchmarks/__init__.py @@ -0,0 +1 @@ + diff --git a/asv_bench/benchmarks/location.py b/asv_bench/benchmarks/location.py new file mode 100644 index 0000000000..7d3de6023f --- /dev/null +++ b/asv_bench/benchmarks/location.py @@ -0,0 +1,20 @@ +# Write the benchmarking functions here. +# See "Writing benchmarks" in the asv docs for more information. + +import pandas as pd +import pvlib + +class TimeSuite: + """ + An example benchmark that times the performance of various kinds + of iterating over dictionaries in Python. + """ + def setup(self): + self.location = pvlib.location.Location(32, -110, altitude=700) + self.times = pd.DatetimeIndex(start='20180601', freq='3min', + periods=1440) + self.solar_position = self.location.get_solarposition(self.times) + + # GH 502 + def time_location_get_airmass(self): + self.location.get_airmass(solar_position=self.solar_position) diff --git a/asv_bench/benchmarks/solarposition.py b/asv_bench/benchmarks/solarposition.py new file mode 100644 index 0000000000..c65397fb00 --- /dev/null +++ b/asv_bench/benchmarks/solarposition.py @@ -0,0 +1,23 @@ +# Write the benchmarking functions here. +# See "Writing benchmarks" in the asv docs for more information. + +import pandas as pd +import pvlib + +class TimeSuite: + """ + An example benchmark that times the performance of various kinds + of iterating over dictionaries in Python. + """ + def setup(self): + self.times = pd.DatetimeIndex(start='20180601', freq='1min', + periods=14400) + self.times_localized = self.times.tz_localize('Etc/GMT+7') + + # GH 512 + def time_ephemeris(self): + pvlib.solarposition.ephemeris(self.times, 35.1, -106.6) + + # GH 512 + def time_ephemeris_localized(self): + pvlib.solarposition.ephemeris(self.times_localized, 35.1, -106.6) diff --git a/docs/sphinx/source/whatsnew/v0.6.0.rst b/docs/sphinx/source/whatsnew/v0.6.0.rst index dc50a50d79..58ec58e738 100644 --- a/docs/sphinx/source/whatsnew/v0.6.0.rst +++ b/docs/sphinx/source/whatsnew/v0.6.0.rst @@ -100,6 +100,8 @@ Testing * Use pytest-mock to ensure that ModelChain DC model is set up correctly. * Add Python 3.7 to build matrix * Make test_forecast.py more robust. (:issue:`293`) +* Add airspeed velocity performance testing configuration and a few tests. + (:issue:`419`) Contributors From d53b782e42aa630a1fa8423052a9638b87e3e384 Mon Sep 17 00:00:00 2001 From: Will Holmgren Date: Mon, 13 Aug 2018 20:59:18 -0700 Subject: [PATCH 02/30] add documentation --- asv_bench/README.md | 42 +++++++++++++++++++++++++++++ docs/sphinx/source/contributing.rst | 11 ++++++++ 2 files changed, 53 insertions(+) create mode 100644 asv_bench/README.md diff --git a/asv_bench/README.md b/asv_bench/README.md new file mode 100644 index 0000000000..ab9d046f19 --- /dev/null +++ b/asv_bench/README.md @@ -0,0 +1,42 @@ +Benchmarks +========== + +pvlib includes a small number of performance benchmarking tests. These +tests are run using +[airspeed velocity](https://asv.readthedocs.io/en/stable/) (ASV). + +The basic structure of the tests and how to run them is described below. +We refer readers to the ASV documentation for more details. + +The test configuration is described in +[``asv.conf.json``](asv.conf.json). + +The performance tests are located in the [benchmarks](benchmarks) directory. + +First, from this directory, run the tests: + +``` +asv run +``` + +Note that, unlike pytest, the asv tests require changes to be committed +to git before they can be tested. The ``run`` command takes a positional +argument to describe the range of git commits or branches to be tested. +For example, if your feature branch is named ``feature``, a useful asv +run may be: + +``` +asv run master..feature +``` + +Next, publish the test results to the archive: + +``` +asv publish +``` + +Finally, start a http server to view the test results: + +``` +asv preview +``` diff --git a/docs/sphinx/source/contributing.rst b/docs/sphinx/source/contributing.rst index 2819a20248..d6407252ce 100644 --- a/docs/sphinx/source/contributing.rst +++ b/docs/sphinx/source/contributing.rst @@ -404,6 +404,17 @@ PVSystem method is called through ``ModelChain.run_model``. assert isinstance(mc.dc, (pd.Series, pd.DataFrame)) +Benchmarking +~~~~~~~~~~~~ + +pvlib includes a small number of performance benchmarking tests. These +tests are run using the `airspeed velocity +`_ tool. We do not require new +performance tests for most contributions at this time. Pull request +reviewers will provide further information if a performance test is +necessary. + + This documentation ~~~~~~~~~~~~~~~~~~ From c75c24d4bb863e817b0f4c1bd88127162d167602 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sat, 21 Mar 2020 19:50:40 -0600 Subject: [PATCH 03/30] move whatsnew line to 0.7.2 --- docs/sphinx/source/whatsnew/v0.6.0.rst | 2 -- docs/sphinx/source/whatsnew/v0.7.2.rst | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.6.0.rst b/docs/sphinx/source/whatsnew/v0.6.0.rst index ddc4a21513..d0197c8bd6 100644 --- a/docs/sphinx/source/whatsnew/v0.6.0.rst +++ b/docs/sphinx/source/whatsnew/v0.6.0.rst @@ -197,8 +197,6 @@ Testing * Use pytest-mock to ensure that ModelChain DC model is set up correctly. * Add Python 3.7 to build matrix * Make test_forecast.py more robust. (:issue:`293`) -* Add airspeed velocity performance testing configuration and a few tests. - (:issue:`419`) * Improve test_atmosphere.py. (:issue:`158`) * Add LGTM.com integration. (:issue:`554`) * Add SticklerCI integration. diff --git a/docs/sphinx/source/whatsnew/v0.7.2.rst b/docs/sphinx/source/whatsnew/v0.7.2.rst index 2eda805c1e..fd08f79262 100644 --- a/docs/sphinx/source/whatsnew/v0.7.2.rst +++ b/docs/sphinx/source/whatsnew/v0.7.2.rst @@ -60,6 +60,8 @@ Testing dependent iotools tests to repeat them on failure. (:pull:`919`) * Separate azure-pipelines.yml platform-specific tests to their own templates located in ``./ci/azure/``. (:pull:`926`) +* Add airspeed velocity performance testing configuration and a few tests. + (:issue:`419`) Documentation ~~~~~~~~~~~~~ From 53568cbba9234287846a2f9d82c2aa67d598b4f6 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sat, 21 Mar 2020 21:22:49 -0600 Subject: [PATCH 04/30] update asv.conf.json to most recent asv format --- asv_bench/asv.conf.json | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/asv_bench/asv.conf.json b/asv_bench/asv.conf.json index ec7050a41b..c27dd715fd 100644 --- a/asv_bench/asv.conf.json +++ b/asv_bench/asv.conf.json @@ -13,6 +13,21 @@ // project being benchmarked "repo": "..", + // The Python project's subdirectory in your repo. If missing or + // the empty string, the project is assumed to be located at the root + // of the repository. + // "repo_subdir": "", + + // Customizable commands for building, installing, and + // uninstalling the project. See asv.conf.json documentation. + // + // "install_command": ["in-dir={env_dir} python -mpip install {wheel_file}"], + // "uninstall_command": ["return-code=any python -mpip uninstall -y {project}"], + // "build_command": [ + // "python setup.py build", + // "PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}" + // ], + // List of branches to benchmark. If not provided, defaults to "master" // (for git) or "default" (for mercurial). // "branches": ["master"], // for git @@ -42,6 +57,10 @@ // to the current version of Python used to run `asv`. // "pythons": ["2.7", "3.7"], + // The list of conda channel names to be searched for benchmark + // dependency packages in the specified order + // "conda_channels": ["conda-forge", "defaults"], + // The matrix of dependencies to test. Each key is the name of a // package (in PyPI) and the values are version numbers. An empty // list or empty string indicates to just test against the default @@ -116,10 +135,10 @@ // The number of characters to retain in the commit hashes. // "hash_length": 8, - // `asv` will cache wheels of the recent builds in each + // `asv` will cache results of the recent builds in each // environment, making them faster to install next time. This is - // number of builds to keep, per environment. - // "wheel_cache_size": 0 + // the number of builds to keep, per environment. + // "build_cache_size": 2, // The commits after which the regression search in `asv publish` // should start looking for regressions. Dictionary whose keys are @@ -132,7 +151,7 @@ // "regressions_first_commits": { // "some_benchmark": "352cdf", // Consider regressions only after this commit // "another_benchmark": null, // Skip regression detection altogether - // } + // }, // The thresholds for relative change in results, after which `asv // publish` starts reporting regressions. Dictionary of the same @@ -143,5 +162,5 @@ // "regressions_thresholds": { // "some_benchmark": 0.01, // Threshold of 1% // "another_benchmark": 0.5, // Threshold of 50% - // } + // }, } From 37095c2bdeefea658fce4e06885a0dfcf18931c9 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sat, 21 Mar 2020 21:54:40 -0600 Subject: [PATCH 05/30] add useful tips to readme --- asv_bench/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/asv_bench/README.md b/asv_bench/README.md index ab9d046f19..1028da7b82 100644 --- a/asv_bench/README.md +++ b/asv_bench/README.md @@ -40,3 +40,17 @@ Finally, start a http server to view the test results: ``` asv preview ``` + +Other useful commands +--------------------- + +The argument passed to `asv run` has the same syntax as `git log` and is +therefore pretty powerful. For instance, you can run a specific tag with +`asv run v0.6.0^!`. + +If a benchmark function is failing and you don't know why, the `-e` option +will display error messages: + +``` +asv run -e +``` \ No newline at end of file From 1c6cbb7dc7fae1ad127455370a9e0fe90a721fe4 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sat, 21 Mar 2020 21:55:36 -0600 Subject: [PATCH 06/30] modify asv conf to install optional pvlib reqs (pytables etc) --- asv_bench/asv.conf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asv_bench/asv.conf.json b/asv_bench/asv.conf.json index c27dd715fd..dc90e6bc55 100644 --- a/asv_bench/asv.conf.json +++ b/asv_bench/asv.conf.json @@ -21,7 +21,7 @@ // Customizable commands for building, installing, and // uninstalling the project. See asv.conf.json documentation. // - // "install_command": ["in-dir={env_dir} python -mpip install {wheel_file}"], + "install_command": ["in-dir={env_dir} python -mpip install {wheel_file}[optional]"], // "uninstall_command": ["return-code=any python -mpip uninstall -y {project}"], // "build_command": [ // "python setup.py build", From 8db2f63bbae9ecae445530e6f5921a32b025fef1 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sat, 21 Mar 2020 21:56:18 -0600 Subject: [PATCH 07/30] add more benchmarks for location and solarposition --- asv_bench/benchmarks/location.py | 35 ++++++++++++++++++++------- asv_bench/benchmarks/solarposition.py | 33 ++++++++++++++++--------- 2 files changed, 48 insertions(+), 20 deletions(-) diff --git a/asv_bench/benchmarks/location.py b/asv_bench/benchmarks/location.py index 7d3de6023f..621fac356d 100644 --- a/asv_bench/benchmarks/location.py +++ b/asv_bench/benchmarks/location.py @@ -1,20 +1,37 @@ -# Write the benchmarking functions here. -# See "Writing benchmarks" in the asv docs for more information. +""" +ASV benchmarks for location.py +""" import pandas as pd import pvlib + class TimeSuite: - """ - An example benchmark that times the performance of various kinds - of iterating over dictionaries in Python. - """ + def setup(self): - self.location = pvlib.location.Location(32, -110, altitude=700) - self.times = pd.DatetimeIndex(start='20180601', freq='3min', - periods=1440) + self.location = pvlib.location.Location(32, -110, altitude=700, + tz='Etc/GMT+7') + self.times = pd.date_range(start='20180601', freq='3min', + periods=1440) + self.days = pd.date_range(start='20180101', freq='d', periods=365, + tz=self.location.tz) self.solar_position = self.location.get_solarposition(self.times) # GH 502 def time_location_get_airmass(self): self.location.get_airmass(solar_position=self.solar_position) + + def time_location_get_solarposition(self): + self.location.get_solarposition(times=self.times) + + def time_location_get_clearsky(self): + self.location.get_clearsky(times=self.times, + solar_position=self.solar_position) + + def time_location_get_sun_rise_set_transit_pyephem(self): + self.location.get_sun_rise_set_transit(times=self.days, + method='pyephem') + + def time_location_get_sun_rise_set_transit_spa(self): + self.location.get_sun_rise_set_transit(times=self.days, + method='spa') diff --git a/asv_bench/benchmarks/solarposition.py b/asv_bench/benchmarks/solarposition.py index c65397fb00..39dae4323b 100644 --- a/asv_bench/benchmarks/solarposition.py +++ b/asv_bench/benchmarks/solarposition.py @@ -1,23 +1,34 @@ -# Write the benchmarking functions here. -# See "Writing benchmarks" in the asv docs for more information. +""" +ASV benchmarks for location.py +""" import pandas as pd -import pvlib +from pvlib import solarposition + class TimeSuite: - """ - An example benchmark that times the performance of various kinds - of iterating over dictionaries in Python. - """ + def setup(self): - self.times = pd.DatetimeIndex(start='20180601', freq='1min', - periods=14400) + self.times = pd.date_range(start='20180601', freq='1min', + periods=14400) self.times_localized = self.times.tz_localize('Etc/GMT+7') + self.lat = 35.1 + self.lon = -106.6 # GH 512 def time_ephemeris(self): - pvlib.solarposition.ephemeris(self.times, 35.1, -106.6) + solarposition.ephemeris(self.times, self.lat, self.lon) # GH 512 def time_ephemeris_localized(self): - pvlib.solarposition.ephemeris(self.times_localized, 35.1, -106.6) + solarposition.ephemeris(self.times_localized, self.lat, self.lon) + + def time_spa_python(self): + solarposition.spa_python(self.times_localized[::5], self.lat, self.lon) + + def time_sun_rise_set_transit_spa(self): + solarposition.sun_rise_set_transit_spa(self.times_localized[::30], + self.lat, self.lon) + + def time_nrel_earthsun_distance(self): + solarposition.nrel_earthsun_distance(self.times_localized) From 48e6366ea3761d608d3a1e7b3db9f4017d125e4f Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sun, 22 Mar 2020 11:14:33 -0600 Subject: [PATCH 08/30] fix solarposition docstring --- asv_bench/benchmarks/solarposition.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asv_bench/benchmarks/solarposition.py b/asv_bench/benchmarks/solarposition.py index 39dae4323b..464161eed0 100644 --- a/asv_bench/benchmarks/solarposition.py +++ b/asv_bench/benchmarks/solarposition.py @@ -1,5 +1,5 @@ """ -ASV benchmarks for location.py +ASV benchmarks for solarposition.py """ import pandas as pd From 636bcafad7229c3f07693cddfab1df6585a0cd77 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sun, 22 Mar 2020 11:49:24 -0600 Subject: [PATCH 09/30] add tracking benchmark file --- asv_bench/benchmarks/tracking.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 asv_bench/benchmarks/tracking.py diff --git a/asv_bench/benchmarks/tracking.py b/asv_bench/benchmarks/tracking.py new file mode 100644 index 0000000000..02ad18b903 --- /dev/null +++ b/asv_bench/benchmarks/tracking.py @@ -0,0 +1,32 @@ +""" +ASV benchmarks for tracking.py +""" + +import pandas as pd +from pvlib import tracking, solarposition + + +class TimeSuite: + + def setup(self): + self.times = pd.date_range(start='20180601', freq='1min', + periods=14400) + self.lat = 35.1 + self.lon = -106.6 + self.solar_position = solarposition.get_solarposition(self.times, + self.lat, + self.lon) + self.tracker = tracking.SingleAxisTracker() + + def time_singleaxis(self): + tracking.singleaxis(self.solar_position.apparent_zenith, + self.solar_position.apparent_azimuth, + axis_tilt=0, + axis_azimuth=0, + max_angle=60, + backtrack=True, + gcr=0.45) + + def time_tracker_singleaxis(self): + self.tracker.singleaxis(self.solar_position.apparent_zenith, + self.solar_position.apparent_azimuth) From 5a935200fd3ea52cc5c64f2897169bf6f370686e Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sun, 22 Mar 2020 11:49:37 -0600 Subject: [PATCH 10/30] add irradiance benchmark file --- asv_bench/benchmarks/irradiance.py | 77 ++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 asv_bench/benchmarks/irradiance.py diff --git a/asv_bench/benchmarks/irradiance.py b/asv_bench/benchmarks/irradiance.py new file mode 100644 index 0000000000..63cf660daf --- /dev/null +++ b/asv_bench/benchmarks/irradiance.py @@ -0,0 +1,77 @@ +""" +ASV benchmarks for irradiance.py +""" + +import pandas as pd +from pvlib import irradiance, location + + +class TimeSuite: + + def setup(self): + self.times = pd.date_range(start='20180601', freq='1min', + periods=14400) + self.days = pd.date_range(start='20180601', freq='d', periods=30) + self.location = location.Location(40, -80) + self.solar_position = self.location.get_solarposition(self.times) + self.clearsky_irradiance = self.location.get_clearsky(self.times) + self.tilt = 20 + self.azimuth = 180 + self.aoi = irradiance.aoi(self.tilt, self.azimuth, + self.solar_position.apparent_zenith, + self.solar_position.azimuth) + + def time_get_extra_radiation(self): + irradiance.get_extra_radiation(self.days) + + def time_aoi(self): + irradiance.aoi(self.tilt, self.azimuth, + self.solar_position.apparent_zenith, + self.solar_position.azimuth) + + def time_aoi_projection(self): + irradiance.aoi(self.tilt, self.azimuth, + self.solar_position.apparent_zenith, + self.solar_position.azimuth) + + def time_get_ground_diffuse(self): + irradiance.get_ground_diffuse(self.tilt, self.clearsky_irradiance.ghi) + + def time_get_total_irradiance(self): + irradiance.get_total_irradiance(self.tilt, self.azimuth, + self.solar_position.apparent_zenith, + self.solar_position.azimuth, + self.clearsky_irradiance.dni, + self.clearsky_irradiance.ghi, + self.clearsky_irradiance.dhi) + + def time_disc(self): + irradiance.disc(self.clearsky_irradiance.ghi, + self.solar_position.apparent_zenith, + self.times) + + def time_dirint(self): + irradiance.dirint(self.clearsky_irradiance.ghi, + self.solar_position.apparent_zenith, + self.times) + + def time_dirindex(self): + irradiance.dirindex(self.clearsky_irradiance.ghi, + self.clearsky_irradiance.ghi, + self.clearsky_irradiance.dni, + self.solar_position.apparent_zenith, + self.times) + + def time_erbs(self): + irradiance.erbs(self.clearsky_irradiance.ghi, + self.solar_position.apparent_zenith, + self.times) + + def time_gti_dirint(self): + irradiance.gti_dirint(poa_global=self.clearsky_irradiance.ghi * 1.3, + aoi=self.aoi, + solar_zenith=self.solar_position.apparent_zenith, + solar_azimuth=self.solar_position.azimuth, + times=self.times, + surface_tilt=self.tilt, + surface_azimuth=self.azimuth) From d480806c959e5a83185aa886b30e64068746e021 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sun, 22 Mar 2020 12:11:29 -0600 Subject: [PATCH 11/30] fix tracking benchmarks --- asv_bench/benchmarks/tracking.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asv_bench/benchmarks/tracking.py b/asv_bench/benchmarks/tracking.py index 02ad18b903..4e45581b62 100644 --- a/asv_bench/benchmarks/tracking.py +++ b/asv_bench/benchmarks/tracking.py @@ -20,7 +20,7 @@ def setup(self): def time_singleaxis(self): tracking.singleaxis(self.solar_position.apparent_zenith, - self.solar_position.apparent_azimuth, + self.solar_position.azimuth, axis_tilt=0, axis_azimuth=0, max_angle=60, @@ -29,4 +29,4 @@ def time_singleaxis(self): def time_tracker_singleaxis(self): self.tracker.singleaxis(self.solar_position.apparent_zenith, - self.solar_position.apparent_azimuth) + self.solar_position.azimuth) From c07003af3edeefddc884dfb5ffeac4ccfce23a61 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Tue, 21 Jul 2020 21:49:17 -0600 Subject: [PATCH 12/30] test python3.7 only, regardless of installed version --- asv_bench/asv.conf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asv_bench/asv.conf.json b/asv_bench/asv.conf.json index dc90e6bc55..e62abe6e84 100644 --- a/asv_bench/asv.conf.json +++ b/asv_bench/asv.conf.json @@ -55,7 +55,7 @@ // The Pythons you'd like to test against. If not provided, defaults // to the current version of Python used to run `asv`. - // "pythons": ["2.7", "3.7"], + "pythons": ["3.7"], // The list of conda channel names to be searched for benchmark // dependency packages in the specified order From 329ba9087e6363ebb362b667de8fe864e6e58040 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Tue, 21 Jul 2020 21:51:23 -0600 Subject: [PATCH 13/30] switch from conda to virtualenv --- asv_bench/asv.conf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asv_bench/asv.conf.json b/asv_bench/asv.conf.json index e62abe6e84..89b95724a9 100644 --- a/asv_bench/asv.conf.json +++ b/asv_bench/asv.conf.json @@ -44,7 +44,7 @@ // If missing or the empty string, the tool will be automatically // determined by looking for tools on the PATH environment // variable. - "environment_type": "conda", + "environment_type": "virtualenv", // timeout in seconds for installing any dependencies in environment // defaults to 10 min From 066bd9ed7b70028156f0e05f03e2b8df1b32f23a Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sat, 5 Sep 2020 16:53:17 -0600 Subject: [PATCH 14/30] restructure --- asv_bench/README.md | 56 ------ asv_bench/asv.conf.json | 166 ------------------ benchmarks/README.md | 10 ++ .../benchmarks => benchmarks}/__init__.py | 0 .../benchmarks => benchmarks}/irradiance.py | 9 - .../benchmarks => benchmarks}/location.py | 16 +- .../solarposition.py | 12 +- .../benchmarks => benchmarks}/tracking.py | 22 +-- 8 files changed, 41 insertions(+), 250 deletions(-) delete mode 100644 asv_bench/README.md delete mode 100644 asv_bench/asv.conf.json create mode 100644 benchmarks/README.md rename {asv_bench/benchmarks => benchmarks}/__init__.py (100%) rename {asv_bench/benchmarks => benchmarks}/irradiance.py (85%) rename {asv_bench/benchmarks => benchmarks}/location.py (62%) rename {asv_bench/benchmarks => benchmarks}/solarposition.py (69%) rename {asv_bench/benchmarks => benchmarks}/tracking.py (52%) diff --git a/asv_bench/README.md b/asv_bench/README.md deleted file mode 100644 index 1028da7b82..0000000000 --- a/asv_bench/README.md +++ /dev/null @@ -1,56 +0,0 @@ -Benchmarks -========== - -pvlib includes a small number of performance benchmarking tests. These -tests are run using -[airspeed velocity](https://asv.readthedocs.io/en/stable/) (ASV). - -The basic structure of the tests and how to run them is described below. -We refer readers to the ASV documentation for more details. - -The test configuration is described in -[``asv.conf.json``](asv.conf.json). - -The performance tests are located in the [benchmarks](benchmarks) directory. - -First, from this directory, run the tests: - -``` -asv run -``` - -Note that, unlike pytest, the asv tests require changes to be committed -to git before they can be tested. The ``run`` command takes a positional -argument to describe the range of git commits or branches to be tested. -For example, if your feature branch is named ``feature``, a useful asv -run may be: - -``` -asv run master..feature -``` - -Next, publish the test results to the archive: - -``` -asv publish -``` - -Finally, start a http server to view the test results: - -``` -asv preview -``` - -Other useful commands ---------------------- - -The argument passed to `asv run` has the same syntax as `git log` and is -therefore pretty powerful. For instance, you can run a specific tag with -`asv run v0.6.0^!`. - -If a benchmark function is failing and you don't know why, the `-e` option -will display error messages: - -``` -asv run -e -``` \ No newline at end of file diff --git a/asv_bench/asv.conf.json b/asv_bench/asv.conf.json deleted file mode 100644 index 89b95724a9..0000000000 --- a/asv_bench/asv.conf.json +++ /dev/null @@ -1,166 +0,0 @@ -{ - // The version of the config file format. Do not change, unless - // you know what you are doing. - "version": 1, - - // The name of the project being benchmarked - "project": "pvlib python", - - // The project's homepage - "project_url": "https://github.com/pvlib/pvlib-python", - - // The URL or local path of the source code repository for the - // project being benchmarked - "repo": "..", - - // The Python project's subdirectory in your repo. If missing or - // the empty string, the project is assumed to be located at the root - // of the repository. - // "repo_subdir": "", - - // Customizable commands for building, installing, and - // uninstalling the project. See asv.conf.json documentation. - // - "install_command": ["in-dir={env_dir} python -mpip install {wheel_file}[optional]"], - // "uninstall_command": ["return-code=any python -mpip uninstall -y {project}"], - // "build_command": [ - // "python setup.py build", - // "PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}" - // ], - - // List of branches to benchmark. If not provided, defaults to "master" - // (for git) or "default" (for mercurial). - // "branches": ["master"], // for git - // "branches": ["default"], // for mercurial - - // The DVCS being used. If not set, it will be automatically - // determined from "repo" by looking at the protocol in the URL - // (if remote), or by looking for special directories, such as - // ".git" (if local). - "dvcs": "git", - - // The tool to use to create environments. May be "conda", - // "virtualenv" or other value depending on the plugins in use. - // If missing or the empty string, the tool will be automatically - // determined by looking for tools on the PATH environment - // variable. - "environment_type": "virtualenv", - - // timeout in seconds for installing any dependencies in environment - // defaults to 10 min - //"install_timeout": 600, - - // the base URL to show a commit for the project. - // "show_commit_url": "http://github.com/pvlib/pvlib-python/commit/", - - // The Pythons you'd like to test against. If not provided, defaults - // to the current version of Python used to run `asv`. - "pythons": ["3.7"], - - // The list of conda channel names to be searched for benchmark - // dependency packages in the specified order - // "conda_channels": ["conda-forge", "defaults"], - - // The matrix of dependencies to test. Each key is the name of a - // package (in PyPI) and the values are version numbers. An empty - // list or empty string indicates to just test against the default - // (latest) version. null indicates that the package is to not be - // installed. If the package to be tested is only available from - // PyPi, and the 'environment_type' is conda, then you can preface - // the package name by 'pip+', and the package will be installed via - // pip (with all the conda available packages installed first, - // followed by the pip installed packages). - // - // "matrix": { - // "numpy": ["1.6", "1.7"], - // "six": ["", null], // test with and without six installed - // "pip+emcee": [""], // emcee is only available for install with pip. - // }, - "matrix": { - "numpy": [""], - "pandas": [""], - "bottleneck": [""], - "numexpr": [""] - }, - - // Combinations of libraries/python versions can be excluded/included - // from the set to test. Each entry is a dictionary containing additional - // key-value pairs to include/exclude. - // - // An exclude entry excludes entries where all values match. The - // values are regexps that should match the whole string. - // - // An include entry adds an environment. Only the packages listed - // are installed. The 'python' key is required. The exclude rules - // do not apply to includes. - // - // In addition to package names, the following keys are available: - // - // - python - // Python version, as in the *pythons* variable above. - // - environment_type - // Environment type, as above. - // - sys_platform - // Platform, as in sys.platform. Possible values for the common - // cases: 'linux2', 'win32', 'cygwin', 'darwin'. - // - // "exclude": [ - // {"python": "3.2", "sys_platform": "win32"}, // skip py3.2 on windows - // {"environment_type": "conda", "six": null}, // don't run without six on conda - // ], - // - // "include": [ - // // additional env for python2.7 - // {"python": "2.7", "numpy": "1.8"}, - // // additional env if run on windows+conda - // {"platform": "win32", "environment_type": "conda", "python": "2.7", "libpython": ""}, - // ], - - // The directory (relative to the current directory) that benchmarks are - // stored in. If not provided, defaults to "benchmarks" - "benchmark_dir": "benchmarks", - - // The directory (relative to the current directory) to cache the Python - // environments in. If not provided, defaults to "env" - "env_dir": ".asv/env", - - // The directory (relative to the current directory) that raw benchmark - // results are stored in. If not provided, defaults to "results". - "results_dir": ".asv/results", - - // The directory (relative to the current directory) that the html tree - // should be written to. If not provided, defaults to "html". - "html_dir": ".asv/html", - - // The number of characters to retain in the commit hashes. - // "hash_length": 8, - - // `asv` will cache results of the recent builds in each - // environment, making them faster to install next time. This is - // the number of builds to keep, per environment. - // "build_cache_size": 2, - - // The commits after which the regression search in `asv publish` - // should start looking for regressions. Dictionary whose keys are - // regexps matching to benchmark names, and values corresponding to - // the commit (exclusive) after which to start looking for - // regressions. The default is to start from the first commit - // with results. If the commit is `null`, regression detection is - // skipped for the matching benchmark. - // - // "regressions_first_commits": { - // "some_benchmark": "352cdf", // Consider regressions only after this commit - // "another_benchmark": null, // Skip regression detection altogether - // }, - - // The thresholds for relative change in results, after which `asv - // publish` starts reporting regressions. Dictionary of the same - // form as in ``regressions_first_commits``, with values - // indicating the thresholds. If multiple entries match, the - // maximum is taken. If no entry matches, the default is 5%. - // - // "regressions_thresholds": { - // "some_benchmark": 0.01, // Threshold of 1% - // "another_benchmark": 0.5, // Threshold of 50% - // }, -} diff --git a/benchmarks/README.md b/benchmarks/README.md new file mode 100644 index 0000000000..5c2578ae12 --- /dev/null +++ b/benchmarks/README.md @@ -0,0 +1,10 @@ +Benchmarks +========== + +pvlib includes a small number of performance benchmarking tests. These +tests are run using airspeed velocity (asv): https://asv.readthedocs.io/en/stable/ + +The benchmarks are run nightly on pvlib-python/master. Useful links: + +- Timing results: https://pvlib-benchmarker.github.io/pvlib-benchmarks/ +- Information on the process: https://github.com/pvlib-benchmarker/pvlib-benchmarks diff --git a/asv_bench/benchmarks/__init__.py b/benchmarks/__init__.py similarity index 100% rename from asv_bench/benchmarks/__init__.py rename to benchmarks/__init__.py diff --git a/asv_bench/benchmarks/irradiance.py b/benchmarks/irradiance.py similarity index 85% rename from asv_bench/benchmarks/irradiance.py rename to benchmarks/irradiance.py index 63cf660daf..656608326f 100644 --- a/asv_bench/benchmarks/irradiance.py +++ b/benchmarks/irradiance.py @@ -66,12 +66,3 @@ def time_erbs(self): irradiance.erbs(self.clearsky_irradiance.ghi, self.solar_position.apparent_zenith, self.times) - - def time_gti_dirint(self): - irradiance.gti_dirint(poa_global=self.clearsky_irradiance.ghi * 1.3, - aoi=self.aoi, - solar_zenith=self.solar_position.apparent_zenith, - solar_azimuth=self.solar_position.azimuth, - times=self.times, - surface_tilt=self.tilt, - surface_azimuth=self.azimuth) diff --git a/asv_bench/benchmarks/location.py b/benchmarks/location.py similarity index 62% rename from asv_bench/benchmarks/location.py rename to benchmarks/location.py index 621fac356d..54b792f85f 100644 --- a/asv_bench/benchmarks/location.py +++ b/benchmarks/location.py @@ -4,7 +4,7 @@ import pandas as pd import pvlib - +from pkg_resources import parse_version class TimeSuite: @@ -28,10 +28,12 @@ def time_location_get_clearsky(self): self.location.get_clearsky(times=self.times, solar_position=self.solar_position) - def time_location_get_sun_rise_set_transit_pyephem(self): - self.location.get_sun_rise_set_transit(times=self.days, - method='pyephem') + if parse_version(pvlib.__version__) >= parse_version('0.6.1'): + def time_location_get_sun_rise_set_transit_pyephem(self): + self.location.get_sun_rise_set_transit(times=self.days, + method='pyephem') - def time_location_get_sun_rise_set_transit_spa(self): - self.location.get_sun_rise_set_transit(times=self.days, - method='spa') + if parse_version(pvlib.__version__) >= parse_version('0.6.1'): + def time_location_get_sun_rise_set_transit_spa(self): + self.location.get_sun_rise_set_transit(times=self.days, + method='spa') diff --git a/asv_bench/benchmarks/solarposition.py b/benchmarks/solarposition.py similarity index 69% rename from asv_bench/benchmarks/solarposition.py rename to benchmarks/solarposition.py index 464161eed0..b6ba5e5d5f 100644 --- a/asv_bench/benchmarks/solarposition.py +++ b/benchmarks/solarposition.py @@ -3,8 +3,16 @@ """ import pandas as pd +import pvlib from pvlib import solarposition +from pkg_resources import parse_version + + +if parse_version(pvlib.__version__) >= parse_version('0.6.1'): + sun_rise_set_transit_spa = solarposition.sun_rise_set_transit_spa +else: + sun_rise_set_transit_spa = solarposition.get_sun_rise_set_transit class TimeSuite: @@ -27,8 +35,8 @@ def time_spa_python(self): solarposition.spa_python(self.times_localized[::5], self.lat, self.lon) def time_sun_rise_set_transit_spa(self): - solarposition.sun_rise_set_transit_spa(self.times_localized[::30], - self.lat, self.lon) + sun_rise_set_transit_spa(self.times_localized[::30], + self.lat, self.lon) def time_nrel_earthsun_distance(self): solarposition.nrel_earthsun_distance(self.times_localized) diff --git a/asv_bench/benchmarks/tracking.py b/benchmarks/tracking.py similarity index 52% rename from asv_bench/benchmarks/tracking.py rename to benchmarks/tracking.py index 4e45581b62..93f3aa6346 100644 --- a/asv_bench/benchmarks/tracking.py +++ b/benchmarks/tracking.py @@ -4,7 +4,7 @@ import pandas as pd from pvlib import tracking, solarposition - +import numpy as np class TimeSuite: @@ -19,14 +19,16 @@ def setup(self): self.tracker = tracking.SingleAxisTracker() def time_singleaxis(self): - tracking.singleaxis(self.solar_position.apparent_zenith, - self.solar_position.azimuth, - axis_tilt=0, - axis_azimuth=0, - max_angle=60, - backtrack=True, - gcr=0.45) + with np.errstate(invalid='ignore'): + tracking.singleaxis(self.solar_position.apparent_zenith, + self.solar_position.azimuth, + axis_tilt=0, + axis_azimuth=0, + max_angle=60, + backtrack=True, + gcr=0.45) def time_tracker_singleaxis(self): - self.tracker.singleaxis(self.solar_position.apparent_zenith, - self.solar_position.azimuth) + with np.errstate(invalid='ignore'): + self.tracker.singleaxis(self.solar_position.apparent_zenith, + self.solar_position.azimuth) From 2e3c76ec7989eb4cebf9343a9672226388a21b49 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sat, 5 Sep 2020 21:07:12 -0600 Subject: [PATCH 15/30] stickler --- benchmarks/__init__.py | 1 - benchmarks/location.py | 1 + benchmarks/solarposition.py | 1 + benchmarks/tracking.py | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/benchmarks/__init__.py b/benchmarks/__init__.py index 8b13789179..e69de29bb2 100644 --- a/benchmarks/__init__.py +++ b/benchmarks/__init__.py @@ -1 +0,0 @@ - diff --git a/benchmarks/location.py b/benchmarks/location.py index 54b792f85f..932c3baa3c 100644 --- a/benchmarks/location.py +++ b/benchmarks/location.py @@ -6,6 +6,7 @@ import pvlib from pkg_resources import parse_version + class TimeSuite: def setup(self): diff --git a/benchmarks/solarposition.py b/benchmarks/solarposition.py index b6ba5e5d5f..7be23a4aaa 100644 --- a/benchmarks/solarposition.py +++ b/benchmarks/solarposition.py @@ -14,6 +14,7 @@ else: sun_rise_set_transit_spa = solarposition.get_sun_rise_set_transit + class TimeSuite: def setup(self): diff --git a/benchmarks/tracking.py b/benchmarks/tracking.py index 93f3aa6346..9c74ac7e72 100644 --- a/benchmarks/tracking.py +++ b/benchmarks/tracking.py @@ -6,6 +6,7 @@ from pvlib import tracking, solarposition import numpy as np + class TimeSuite: def setup(self): From 3f5b1bacb32b3f8d1f3fc750714c8835185f9790 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sat, 5 Sep 2020 21:41:21 -0600 Subject: [PATCH 16/30] drop old whatsnew entry --- docs/sphinx/source/whatsnew/v0.7.2.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.7.2.rst b/docs/sphinx/source/whatsnew/v0.7.2.rst index 6db8164378..8cabb37cfb 100644 --- a/docs/sphinx/source/whatsnew/v0.7.2.rst +++ b/docs/sphinx/source/whatsnew/v0.7.2.rst @@ -80,8 +80,6 @@ Testing dependent iotools tests to repeat them on failure. (:pull:`919`) * Separate azure-pipelines.yml platform-specific tests to their own templates located in ``./ci/azure/``. (:pull:`926`) -* Add airspeed velocity performance testing configuration and a few tests. - (:issue:`419`) Documentation ~~~~~~~~~~~~~ From 008f8ca8bb92a5fe6ccdb7cb37027083e2d602d7 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Sun, 6 Sep 2020 14:12:08 -0600 Subject: [PATCH 17/30] use separate classes for version checking --- benchmarks/irradiance.py | 2 +- benchmarks/location.py | 43 +++++++++++++++++++------------ benchmarks/solarposition.py | 2 +- benchmarks/temperature.py | 50 +++++++++++++++++++++++++++++++++++++ benchmarks/tracking.py | 2 +- 5 files changed, 80 insertions(+), 19 deletions(-) create mode 100644 benchmarks/temperature.py diff --git a/benchmarks/irradiance.py b/benchmarks/irradiance.py index 656608326f..3c1d8713a2 100644 --- a/benchmarks/irradiance.py +++ b/benchmarks/irradiance.py @@ -6,7 +6,7 @@ from pvlib import irradiance, location -class TimeSuite: +class Irradiance: def setup(self): self.times = pd.date_range(start='20180601', freq='1min', diff --git a/benchmarks/location.py b/benchmarks/location.py index 932c3baa3c..2356ca1e7e 100644 --- a/benchmarks/location.py +++ b/benchmarks/location.py @@ -7,16 +7,20 @@ from pkg_resources import parse_version -class TimeSuite: +def set_solar_position(obj): + obj.location = pvlib.location.Location(32, -110, altitude=700, + tz='Etc/GMT+7') + obj.times = pd.date_range(start='20180601', freq='3min', + periods=1440) + obj.days = pd.date_range(start='20180101', freq='d', periods=365, + tz=obj.location.tz) + obj.solar_position = obj.location.get_solarposition(obj.times) + + +class Location: def setup(self): - self.location = pvlib.location.Location(32, -110, altitude=700, - tz='Etc/GMT+7') - self.times = pd.date_range(start='20180601', freq='3min', - periods=1440) - self.days = pd.date_range(start='20180101', freq='d', periods=365, - tz=self.location.tz) - self.solar_position = self.location.get_solarposition(self.times) + set_solar_position(self) # GH 502 def time_location_get_airmass(self): @@ -29,12 +33,19 @@ def time_location_get_clearsky(self): self.location.get_clearsky(times=self.times, solar_position=self.solar_position) - if parse_version(pvlib.__version__) >= parse_version('0.6.1'): - def time_location_get_sun_rise_set_transit_pyephem(self): - self.location.get_sun_rise_set_transit(times=self.days, - method='pyephem') - if parse_version(pvlib.__version__) >= parse_version('0.6.1'): - def time_location_get_sun_rise_set_transit_spa(self): - self.location.get_sun_rise_set_transit(times=self.days, - method='spa') +class Location_0_6_1: + + def setup(self): + if parse_version(pvlib.__version__) < parse_version('0.6.1'): + raise NotImplementedError + + set_solar_position(self) + + def time_location_get_sun_rise_set_transit_pyephem(self): + self.location.get_sun_rise_set_transit(times=self.days, + method='pyephem') + + def time_location_get_sun_rise_set_transit_spa(self): + self.location.get_sun_rise_set_transit(times=self.days, + method='spa') diff --git a/benchmarks/solarposition.py b/benchmarks/solarposition.py index 7be23a4aaa..594f8259cd 100644 --- a/benchmarks/solarposition.py +++ b/benchmarks/solarposition.py @@ -15,7 +15,7 @@ sun_rise_set_transit_spa = solarposition.get_sun_rise_set_transit -class TimeSuite: +class SolarPosition: def setup(self): self.times = pd.date_range(start='20180601', freq='1min', diff --git a/benchmarks/temperature.py b/benchmarks/temperature.py new file mode 100644 index 0000000000..6d5ea16da2 --- /dev/null +++ b/benchmarks/temperature.py @@ -0,0 +1,50 @@ +""" +ASV benchmarks for irradiance.py +""" + +import pandas as pd +import pvlib +from pkg_resources import parse_version +import functools + + +def set_weather_data(obj): + obj.times = pd.date_range(start='20180601', freq='1min', + periods=14400) + obj.poa = pd.Series(1000, index=obj.times) + obj.tamb = pd.Series(20, index=obj.times) + obj.windspeed = pd.Series(2, index=obj.times) + + +if parse_version(pvlib.__version__) >= parse_version('0.7.0'): + params = pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS['sapm'] + params = params['open_rack_glass_glass'] + sapm_cell = functools.partial(pvlib.temperature.sapm_cell, **params) +else: + sapm_celltemp = pvlib.pvsystem.sapm_celltemp + + def sapm_cell(poa_global, temp_air, wind_speed): + return sapm_celltemp(poa_global, wind_speed, temp_air) + + +class SAPM: + + def setup(self): + set_weather_data(self) + + def time_sapm_cell(self): + # use version-appropriate wrapper + sapm_cell(self.poa, self.tamb, self.windspeed) + + +class Fuentes: + + def setup(self): + if parse_version(pvlib.__version__) < parse_version('0.8.0'): + raise NotImplementedError + + set_weather_data(self) + + def time_fuentes(self): + pvlib.temperature.fuentes(self.poa, self.tamb, self.wind_speed, + noct_installed=45) diff --git a/benchmarks/tracking.py b/benchmarks/tracking.py index 9c74ac7e72..a0e5a45115 100644 --- a/benchmarks/tracking.py +++ b/benchmarks/tracking.py @@ -7,7 +7,7 @@ import numpy as np -class TimeSuite: +class SingleAxis: def setup(self): self.times = pd.date_range(start='20180601', freq='1min', From 25d7b9f05719804ece8a2f01a9493082a139d9dc Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Mon, 7 Sep 2020 10:36:07 -0600 Subject: [PATCH 18/30] fix aoi_projection benchmark --- benchmarks/irradiance.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmarks/irradiance.py b/benchmarks/irradiance.py index 3c1d8713a2..75cf6e965f 100644 --- a/benchmarks/irradiance.py +++ b/benchmarks/irradiance.py @@ -30,9 +30,9 @@ def time_aoi(self): self.solar_position.azimuth) def time_aoi_projection(self): - irradiance.aoi(self.tilt, self.azimuth, - self.solar_position.apparent_zenith, - self.solar_position.azimuth) + irradiance.aoi_projection(self.tilt, self.azimuth, + self.solar_position.apparent_zenith, + self.solar_position.azimuth) def time_get_ground_diffuse(self): irradiance.get_ground_diffuse(self.tilt, self.clearsky_irradiance.ghi) From daf7e40531e6116a4da4ea47f2c9f2d77cb5ef29 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Mon, 7 Sep 2020 11:46:19 -0600 Subject: [PATCH 19/30] do version switching in setup() instead of in global scope --- benchmarks/temperature.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/benchmarks/temperature.py b/benchmarks/temperature.py index 6d5ea16da2..bb1a92e6af 100644 --- a/benchmarks/temperature.py +++ b/benchmarks/temperature.py @@ -5,7 +5,7 @@ import pandas as pd import pvlib from pkg_resources import parse_version -import functools +from functools import partial def set_weather_data(obj): @@ -16,25 +16,26 @@ def set_weather_data(obj): obj.windspeed = pd.Series(2, index=obj.times) -if parse_version(pvlib.__version__) >= parse_version('0.7.0'): - params = pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS['sapm'] - params = params['open_rack_glass_glass'] - sapm_cell = functools.partial(pvlib.temperature.sapm_cell, **params) -else: - sapm_celltemp = pvlib.pvsystem.sapm_celltemp - - def sapm_cell(poa_global, temp_air, wind_speed): - return sapm_celltemp(poa_global, wind_speed, temp_air) - - class SAPM: def setup(self): set_weather_data(self) + if parse_version(pvlib.__version__) >= parse_version('0.7.0'): + kwargs = pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS['sapm'] + kwargs = kwargs['open_rack_glass_glass'] + self.sapm_cell_wrapper = partial(pvlib.temperature.sapm_cell, + **kwargs) + else: + sapm_celltemp = pvlib.pvsystem.sapm_celltemp + + def sapm_cell_wrapper(poa_global, temp_air, wind_speed): + # just swap order; model params are provided by default + return sapm_celltemp(poa_global, wind_speed, temp_air) + self.sapm_cell_wrapper = sapm_cell_wrapper def time_sapm_cell(self): # use version-appropriate wrapper - sapm_cell(self.poa, self.tamb, self.windspeed) + self.sapm_cell_wrapper(self.poa, self.tamb, self.windspeed) class Fuentes: From c7bb2ec27a032637697479b690d2228d3f6a5f2b Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Mon, 7 Sep 2020 11:48:48 -0600 Subject: [PATCH 20/30] singular space to satisfy stickler --- benchmarks/temperature.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/temperature.py b/benchmarks/temperature.py index bb1a92e6af..dfefbf0a6c 100644 --- a/benchmarks/temperature.py +++ b/benchmarks/temperature.py @@ -24,7 +24,7 @@ def setup(self): kwargs = pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS['sapm'] kwargs = kwargs['open_rack_glass_glass'] self.sapm_cell_wrapper = partial(pvlib.temperature.sapm_cell, - **kwargs) + **kwargs) else: sapm_celltemp = pvlib.pvsystem.sapm_celltemp From 01e79a42b81acb569be0199119f50e444e95e51e Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Mon, 7 Sep 2020 18:36:59 -0600 Subject: [PATCH 21/30] move asv conf to pvlib --- benchmarks/asv.conf.json | 162 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 benchmarks/asv.conf.json diff --git a/benchmarks/asv.conf.json b/benchmarks/asv.conf.json new file mode 100644 index 0000000000..41fedfdca5 --- /dev/null +++ b/benchmarks/asv.conf.json @@ -0,0 +1,162 @@ +{ + // The version of the config file format. Do not change, unless + // you know what you are doing. + "version": 1, + + // The name of the project being benchmarked + "project": "pvlib-python", + + // The project's homepage + "project_url": "https://pvlib-python.readthedocs.io", + + // The URL or local path of the source code repository for the + // project being benchmarked + "repo": "https://github.com/pvlib/pvlib-python", + + // The Python project's subdirectory in your repo. If missing or + // the empty string, the project is assumed to be located at the root + // of the repository. + // "repo_subdir": "", + + // Customizable commands for building, installing, and + // uninstalling the project. See asv.conf.json documentation. + // + // "install_command": ["in-dir={env_dir} python -mpip install {wheel_file}"], + // "uninstall_command": ["return-code=any python -mpip uninstall -y {project}"], + // "build_command": [ + // "python setup.py build", + // "PIP_NO_BUILD_ISOLATION=false python -mpip wheel --no-deps --no-index -w {build_cache_dir} {build_dir}" + // ], + + // List of branches to benchmark. If not provided, defaults to "master" + // (for git) or "default" (for mercurial). + // "branches": ["master"], // for git + // "branches": ["default"], // for mercurial + + // The DVCS being used. If not set, it will be automatically + // determined from "repo" by looking at the protocol in the URL + // (if remote), or by looking for special directories, such as + // ".git" (if local). + "dvcs": "git", + + // The tool to use to create environments. May be "conda", + // "virtualenv" or other value depending on the plugins in use. + // If missing or the empty string, the tool will be automatically + // determined by looking for tools on the PATH environment + // variable. + "environment_type": "conda", + + // timeout in seconds for installing any dependencies in environment + // defaults to 10 min + //"install_timeout": 600, + + // the base URL to show a commit for the project. + "show_commit_url": "http://github.com/pvlib/pvlib-python/commit/", + + // The Pythons you'd like to test against. If not provided, defaults + // to the current version of Python used to run `asv`. + "pythons": ["3.7"], + + // The list of conda channel names to be searched for benchmark + // dependency packages in the specified order + // "conda_channels": ["conda-forge", "defaults"], + + // The matrix of dependencies to test. Each key is the name of a + // package (in PyPI) and the values are version numbers. An empty + // list or empty string indicates to just test against the default + // (latest) version. null indicates that the package is to not be + // installed. If the package to be tested is only available from + // PyPi, and the 'environment_type' is conda, then you can preface + // the package name by 'pip+', and the package will be installed via + // pip (with all the conda available packages installed first, + // followed by the pip installed packages). + // + "matrix": { + "numpy": ["1.18.5"], + "pandas": ["1.1.0"], + "scipy": ["1.2.0"], + "pytables": ["3.6.1"], + "ephem": ["3.7.6.0"], + }, + + // Combinations of libraries/python versions can be excluded/included + // from the set to test. Each entry is a dictionary containing additional + // key-value pairs to include/exclude. + // + // An exclude entry excludes entries where all values match. The + // values are regexps that should match the whole string. + // + // An include entry adds an environment. Only the packages listed + // are installed. The 'python' key is required. The exclude rules + // do not apply to includes. + // + // In addition to package names, the following keys are available: + // + // - python + // Python version, as in the *pythons* variable above. + // - environment_type + // Environment type, as above. + // - sys_platform + // Platform, as in sys.platform. Possible values for the common + // cases: 'linux2', 'win32', 'cygwin', 'darwin'. + // + // "exclude": [ + // {"python": "3.2", "sys_platform": "win32"}, // skip py3.2 on windows + // {"environment_type": "conda", "six": null}, // don't run without six on conda + // ], + // + // "include": [ + // // additional env for python2.7 + // {"python": "2.7", "numpy": "1.8"}, + // // additional env if run on windows+conda + // {"platform": "win32", "environment_type": "conda", "python": "2.7", "libpython": ""}, + // ], + + // The directory (relative to the current directory) that benchmarks are + // stored in. If not provided, defaults to "benchmarks" + "benchmark_dir": "benchmarks", + + // The directory (relative to the current directory) to cache the Python + // environments in. If not provided, defaults to "env" + // "env_dir": "env", + + // The directory (relative to the current directory) that raw benchmark + // results are stored in. If not provided, defaults to "results". + // "results_dir": "results", + + // The directory (relative to the current directory) that the html tree + // should be written to. If not provided, defaults to "html". + // "html_dir": "html", + + // The number of characters to retain in the commit hashes. + // "hash_length": 8, + + // `asv` will cache results of the recent builds in each + // environment, making them faster to install next time. This is + // the number of builds to keep, per environment. + // "build_cache_size": 2, + + // The commits after which the regression search in `asv publish` + // should start looking for regressions. Dictionary whose keys are + // regexps matching to benchmark names, and values corresponding to + // the commit (exclusive) after which to start looking for + // regressions. The default is to start from the first commit + // with results. If the commit is `null`, regression detection is + // skipped for the matching benchmark. + // + // "regressions_first_commits": { + // "some_benchmark": "352cdf", // Consider regressions only after this commit + // "another_benchmark": null, // Skip regression detection altogether + // }, + + // The thresholds for relative change in results, after which `asv + // publish` starts reporting regressions. Dictionary of the same + // form as in ``regressions_first_commits``, with values + // indicating the thresholds. If multiple entries match, the + // maximum is taken. If no entry matches, the default is 5%. + // + // "regressions_thresholds": { + // "some_benchmark": 0.01, // Threshold of 1% + // "another_benchmark": 0.5, // Threshold of 50% + // }, +} From 0ff98b624d9eed75259b4686b441a2df05a18d1b Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Mon, 7 Sep 2020 18:41:13 -0600 Subject: [PATCH 22/30] move benchmarks to subdirectory --- .gitignore | 5 +++++ benchmarks/{ => benchmarks}/__init__.py | 0 benchmarks/{ => benchmarks}/irradiance.py | 0 benchmarks/{ => benchmarks}/location.py | 0 benchmarks/{ => benchmarks}/solarposition.py | 0 benchmarks/{ => benchmarks}/temperature.py | 0 benchmarks/{ => benchmarks}/tracking.py | 0 7 files changed, 5 insertions(+) rename benchmarks/{ => benchmarks}/__init__.py (100%) rename benchmarks/{ => benchmarks}/irradiance.py (100%) rename benchmarks/{ => benchmarks}/location.py (100%) rename benchmarks/{ => benchmarks}/solarposition.py (100%) rename benchmarks/{ => benchmarks}/temperature.py (100%) rename benchmarks/{ => benchmarks}/tracking.py (100%) diff --git a/.gitignore b/.gitignore index b7cd3bef6f..1667960d27 100644 --- a/.gitignore +++ b/.gitignore @@ -92,3 +92,8 @@ coverage.xml # Ignore Mac DS_store files *.DS_Store + +# airspeed velocity +env +results + diff --git a/benchmarks/__init__.py b/benchmarks/benchmarks/__init__.py similarity index 100% rename from benchmarks/__init__.py rename to benchmarks/benchmarks/__init__.py diff --git a/benchmarks/irradiance.py b/benchmarks/benchmarks/irradiance.py similarity index 100% rename from benchmarks/irradiance.py rename to benchmarks/benchmarks/irradiance.py diff --git a/benchmarks/location.py b/benchmarks/benchmarks/location.py similarity index 100% rename from benchmarks/location.py rename to benchmarks/benchmarks/location.py diff --git a/benchmarks/solarposition.py b/benchmarks/benchmarks/solarposition.py similarity index 100% rename from benchmarks/solarposition.py rename to benchmarks/benchmarks/solarposition.py diff --git a/benchmarks/temperature.py b/benchmarks/benchmarks/temperature.py similarity index 100% rename from benchmarks/temperature.py rename to benchmarks/benchmarks/temperature.py diff --git a/benchmarks/tracking.py b/benchmarks/benchmarks/tracking.py similarity index 100% rename from benchmarks/tracking.py rename to benchmarks/benchmarks/tracking.py From d42ef6d65de3f88b688d323b4343612643312739 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Tue, 8 Sep 2020 21:13:04 -0600 Subject: [PATCH 23/30] change to local repo instead of cloning from GH --- benchmarks/asv.conf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/asv.conf.json b/benchmarks/asv.conf.json index 41fedfdca5..a13d0af4aa 100644 --- a/benchmarks/asv.conf.json +++ b/benchmarks/asv.conf.json @@ -11,7 +11,7 @@ // The URL or local path of the source code repository for the // project being benchmarked - "repo": "https://github.com/pvlib/pvlib-python", + "repo": "..", // The Python project's subdirectory in your repo. If missing or // the empty string, the project is assumed to be located at the root From 37993fa97d976f35cd7f9090d7adfa60097724a4 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Tue, 8 Sep 2020 21:13:12 -0600 Subject: [PATCH 24/30] docs --- benchmarks/README.md | 74 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/benchmarks/README.md b/benchmarks/README.md index 5c2578ae12..889cdabd65 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -2,9 +2,79 @@ Benchmarks ========== pvlib includes a small number of performance benchmarking tests. These -tests are run using airspeed velocity (asv): https://asv.readthedocs.io/en/stable/ +tests are run using +[airspeed velocity](https://asv.readthedocs.io/en/stable/) (ASV). -The benchmarks are run nightly on pvlib-python/master. Useful links: +The basic structure of the tests and how to run them is described below. +We refer readers to the ASV documentation for more details. The AstroPy +[documentation](https://github.com/astropy/astropy-benchmarks/tree/master) +may also be helpful. + +The test configuration is described in [asv.conf.json](asv.conf.json). + +The performance tests are located in the [benchmarks](benchmarks) directory. + +First, from the same directory as `asv.conf.json`, run the tests in a +command prompt (`$`): + +``` +$ asv run +``` + +Note that, unlike pytest, the asv tests require changes to be committed +to git before they can be tested. The ``run`` command takes a positional +argument to describe the range of git commits or branches to be tested. +For example, if your feature branch is named ``feature``, a useful asv +run may be: + +``` +$ asv run master..feature +``` + +Next, publish the test results to the archive: + +``` +$ asv publish +``` + +Finally, start a http server to view the test results: + +``` +$ asv preview +``` + +You might also find it useful to compare results from the command line +instead of through the HTML report. After generating timing results by +benchmarking a series of commits as above, or running individual commits +like this: + +``` +asv run e42f8d24^! +``` + +You can then compare the timing results of two commits: + +``` +$ asv compare 0ff98b62 e42f8d24 + +All benchmarks: + + before after ratio + [0ff98b62] [e42f8d24] + ++ 3.90±0.6ms 31.3±5ms 8.03 irradiance.Irradiance.time_aoi + 3.12±0.4ms 2.94±0.2ms 0.94 irradiance.Irradiance.time_aoi_projection + 256±9ms 267±10ms 1.05 irradiance.Irradiance.time_dirindex +``` + +The `ratio` column shows the ratio of `after / before` timings. For this +example, the `aoi` function was slowed down on purpose to demonstrate +the comparison. + +Nightly benchmarking +-------------------- + +The benchmarks are run nightly for new commits to pvlib-python/master. - Timing results: https://pvlib-benchmarker.github.io/pvlib-benchmarks/ - Information on the process: https://github.com/pvlib-benchmarker/pvlib-benchmarks From 605d7448b1de478dba6124d960c29d0f9a817523 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Tue, 8 Sep 2020 22:03:44 -0600 Subject: [PATCH 25/30] update benchmark readme --- benchmarks/README.md | 55 +++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/benchmarks/README.md b/benchmarks/README.md index 889cdabd65..b0e27c5214 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -11,45 +11,34 @@ We refer readers to the ASV documentation for more details. The AstroPy may also be helpful. The test configuration is described in [asv.conf.json](asv.conf.json). - The performance tests are located in the [benchmarks](benchmarks) directory. -First, from the same directory as `asv.conf.json`, run the tests in a -command prompt (`$`): - -``` -$ asv run -``` +Comparing timings +----------------- Note that, unlike pytest, the asv tests require changes to be committed to git before they can be tested. The ``run`` command takes a positional argument to describe the range of git commits or branches to be tested. For example, if your feature branch is named ``feature``, a useful asv -run may be: +run may be (from the same directory as `asv.conf.json`): ``` $ asv run master..feature ``` -Next, publish the test results to the archive: +This will generate timings for every commit between the two specified +revisions. If you only care about certain commits, you can run them by +their git hashes directly like this: ``` -$ asv publish +$ asv run e42f8d24^! ``` -Finally, start a http server to view the test results: +Note: depending on what shell they use, Windows users may need to use +double-carets: ``` -$ asv preview -``` - -You might also find it useful to compare results from the command line -instead of through the HTML report. After generating timing results by -benchmarking a series of commits as above, or running individual commits -like this: - -``` -asv run e42f8d24^! +$ asv run e42f8d24^^! ``` You can then compare the timing results of two commits: @@ -71,6 +60,30 @@ The `ratio` column shows the ratio of `after / before` timings. For this example, the `aoi` function was slowed down on purpose to demonstrate the comparison. +Generating an HTML report +------------------------- + +asv can generate a collection of interactive plots of benchmark timings across +a commit history. First, generate timings for a series of commits, like: + +``` +$ asv run v0.6.0..v0.8.0 +``` + +Next, generate the HTML report: + +``` +$ asv publish +``` + +Finally, start a http server to view the test results: + +``` +$ asv preview + +``` + + Nightly benchmarking -------------------- From 73e634772331f7e8330e5c7dc9e12f614f5cb084 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Wed, 9 Sep 2020 18:58:07 -0600 Subject: [PATCH 26/30] create 0.8.1 whatsnew --- docs/sphinx/source/whatsnew/v0.8.1.rst | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 docs/sphinx/source/whatsnew/v0.8.1.rst diff --git a/docs/sphinx/source/whatsnew/v0.8.1.rst b/docs/sphinx/source/whatsnew/v0.8.1.rst new file mode 100644 index 0000000000..4bc09643ac --- /dev/null +++ b/docs/sphinx/source/whatsnew/v0.8.1.rst @@ -0,0 +1,37 @@ +.. _whatsnew_0810: + +v0.8.1 (MONTH DAY YEAR) +----------------------- + +Breaking changes +~~~~~~~~~~~~~~~~ + + +Deprecations +~~~~~~~~~~~~ + + +Enhancements +~~~~~~~~~~~~ + + +Bug fixes +~~~~~~~~~ + + +Testing +~~~~~~~ +* Add airspeed velocity performance testing configuration and a few benchmarks. + (:issue:`419`, :pull:`1049`) + +Documentation +~~~~~~~~~~~~~ + + +Requirements +~~~~~~~~~~~~ + + +Contributors +~~~~~~~~~~~~ +* Kevin Anderson (:ghuser:`kanderso-nrel`) From 791ee9bb9e17edbabbaa762bfd9e2d321c7e075c Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Wed, 9 Sep 2020 18:58:21 -0600 Subject: [PATCH 27/30] conda channel ordering --- benchmarks/asv.conf.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/asv.conf.json b/benchmarks/asv.conf.json index a13d0af4aa..84601c8947 100644 --- a/benchmarks/asv.conf.json +++ b/benchmarks/asv.conf.json @@ -59,7 +59,7 @@ // The list of conda channel names to be searched for benchmark // dependency packages in the specified order - // "conda_channels": ["conda-forge", "defaults"], + "conda_channels": ["defaults", "conda-forge"], // The matrix of dependencies to test. Each key is the name of a // package (in PyPI) and the values are version numbers. An empty From 64adc8400554e50a1a0501dc00748d7a9d18502a Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Wed, 9 Sep 2020 18:58:44 -0600 Subject: [PATCH 28/30] link to readme --- docs/sphinx/source/contributing.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/sphinx/source/contributing.rst b/docs/sphinx/source/contributing.rst index d1b1c83d7e..64e60228f7 100644 --- a/docs/sphinx/source/contributing.rst +++ b/docs/sphinx/source/contributing.rst @@ -490,7 +490,9 @@ tests are run using the `airspeed velocity `_ tool. We do not require new performance tests for most contributions at this time. Pull request reviewers will provide further information if a performance test is -necessary. +necessary. See our `README +`_ +for instructions on running the benchmarks. This documentation From 10214007375f49e4fa9d30214f3cc97ce0b8a53f Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Wed, 9 Sep 2020 19:02:23 -0600 Subject: [PATCH 29/30] fix wrong link --- docs/sphinx/source/contributing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/contributing.rst b/docs/sphinx/source/contributing.rst index 64e60228f7..247a64f58c 100644 --- a/docs/sphinx/source/contributing.rst +++ b/docs/sphinx/source/contributing.rst @@ -491,7 +491,7 @@ tests are run using the `airspeed velocity performance tests for most contributions at this time. Pull request reviewers will provide further information if a performance test is necessary. See our `README -`_ +`_ for instructions on running the benchmarks. From 85235a5990de99a3a0f6e2cd54f68fc6b9c9e607 Mon Sep 17 00:00:00 2001 From: Kevin Anderson Date: Wed, 9 Sep 2020 21:04:41 -0600 Subject: [PATCH 30/30] benchmark on minimum and latest dependency versions --- benchmarks/asv.conf.json | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/benchmarks/asv.conf.json b/benchmarks/asv.conf.json index 84601c8947..b586ae1848 100644 --- a/benchmarks/asv.conf.json +++ b/benchmarks/asv.conf.json @@ -55,7 +55,7 @@ // The Pythons you'd like to test against. If not provided, defaults // to the current version of Python used to run `asv`. - "pythons": ["3.7"], + "pythons": ["dummy"], // this gets excluded below // The list of conda channel names to be searched for benchmark // dependency packages in the specified order @@ -71,13 +71,7 @@ // pip (with all the conda available packages installed first, // followed by the pip installed packages). // - "matrix": { - "numpy": ["1.18.5"], - "pandas": ["1.1.0"], - "scipy": ["1.2.0"], - "pytables": ["3.6.1"], - "ephem": ["3.7.6.0"], - }, + "matrix": {}, // pvlib dependencies specified in the `include` list below // Combinations of libraries/python versions can be excluded/included // from the set to test. Each entry is a dictionary containing additional @@ -112,6 +106,36 @@ // {"platform": "win32", "environment_type": "conda", "python": "2.7", "libpython": ""}, // ], + // asv takes the Cartesian product of the 'matrix' version spec, so it's + // no good for specifying sets of versions. Instead we'll use the + // 'include' machinery to specify each set of versions to benchmark. + // However, the 'pythons' key ends up generating an undesirable extra + // environment, so we 'exclude' it. + "include": [ + // minimum supported versions + { + "python": "3.6", + "numpy": "1.12.0", + "pandas": "0.22.0", + "scipy": "1.2.0", + // Note: these don't have a minimum in setup.py + "pytables": "3.6.1", + "ephem": "3.7.6.0", + }, + // latest versions available + { + "python": "3.8", + "numpy": "", + "pandas": "", + "scipy": "", + "pytables": "", + "ephem": "", + }, + ], + "exclude": [ + {"python": "dummy"} + ], + // The directory (relative to the current directory) that benchmarks are // stored in. If not provided, defaults to "benchmarks" "benchmark_dir": "benchmarks",