https://github.com/astropy/astropy-benchmarks

Benchmarks for the astropy project

https://github.com/astropy/astropy-benchmarks

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    3 of 23 committers (13.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.2%) to scientific vocabulary

Keywords from Contributors

astronomy astropy astrophysics astropy-affiliated closember notebooks photometry source-detection advanced-scientific-data-format asdf
Last synced: 10 months ago · JSON representation

Repository

Benchmarks for the astropy project

Basic Info
Statistics
  • Stars: 9
  • Watchers: 23
  • Forks: 30
  • Open Issues: 18
  • Releases: 0
Created over 12 years ago · Last pushed 12 months ago
Metadata Files
Readme License Code of conduct

README.md

Astropy performance benchmarks

About

This repository includes a set of benchmarks to regularly test the performance of various parts of the astropy core package. These benchmarks are run for every new commit in the core package repository and the results are published using a user-friendly web interface. The benchmarks are run using airspeed velocity on dedicated physical machines belonging to members of the Astropy developer community.

Running the benchmarks locally

If you want to try and run the benchmarks locally you will first need to install asv

shell pip install asv

then clone the benchmarks repository

shell git clone git@github.com:astropy/astropy-benchmarks.git --single-branch cd astropy-benchmarks

Note that the --single-branch option is to avoid downloading the results branch, which is large.

The easiest/fastest way to try out the benchmarks is to make sure you have either a stable or a developer version of astropy installed, then run

shell asv run --python=same --quick --show-stderr --dry-run

This will run the benchmarks against the local astropy version and will do some basic timing, but the timing will not be very accurate, because this only runs each benchmark once instead of taking an average of many runs. Nevertheless, this is the first step to make sure things are running correctly and can still give order of magnitude timings.

To run asv properly on the latest commit in the upstream astropy main, you can do

shell asv run

This will set up a temporary environment in which astropy will be installed, and the benchmark functions will be run multiple times and averaged to get accurate timings. The results from this will be saved into a results/<machine-name> directory, which will store one file per commit (or more than one file if the tests are set up to run for multiple python or numpy versions, which they are not configured to do by default for Astropy).

You can specify the commit(s) to run the benchmarks for by using the same syntax as you would for the git log command. For example, to run the benchmarks for a single specific commit, you can do

shell asv run 88fbbc33^!

replacing 88fbbc33 by the commit you want to test (the ^! Indicates to just run this commit, not all commits up to that point). If you want to run a range of commits, use

shell asv run 827f322b..729abcf3

For the best accuracy, if you are using Linux, you can prevent core-swapping (which can introduce some noise in the timings) by running asv with

shell taskset -c 0 asv ...

This will ensure that the whole process runs on the same core.

You can generate a user-friendly web interface for your results locally by running

shell asv publish asv preview

The asv preview command will give the URL of the local web server (e.g. http://127.0.0.1:21331) - go to this address in your favorite browser to see the results.

Running benchmarks with specific versions of dependencies

If you would like to run the benchmarks against specific version(s) of an installed dependency (or dependencies), modify asv.conf.json to add matrix.req with the desired version(s):

diff { "version": 1, "project": "astropy", "project_url": "http://www.astropy.org/", "repo": "https://github.com/astropy/astropy.git", "install_command": [ "pip install . matplotlib scipy" ], + "matrix": { + "req": { + "matplotlib": [ + "3.5.1" + ], + "numpy": [ + "1.26.0", + "2.0.0rc1" + ] + } + }, "branches": ["main"], "show_commit_url": "http://github.com/astropy/astropy/commit/", "pythons": ["3.11"], "environment_type": "virtualenv" }

Writing a benchmark

To write a new benchmark, fork this repository and take a look inside the benchmarks folder - each module in astropy that already has benchmarks has a corresponding file or directory with files for different parts of the module. Either add your benchmark to one of the existing files or create a new file as needed.

A benchmark is a Python function whose name starts with time_. A function should test as little as possible and therefore be as short/simple as possible. Any required imports should be done outside the function. Here is an example of a benchmark to test unit conversion:

```python from astropy import units as u

def timemybenchmark(): (u.m / u.s).to(u.km / u.h) ```

Once you have added a benchmark, you can make sure it runs by running

shell asv run --python=same --quick --show-stderr --dry-run

As mentioned in [Running the benchmarks locally], this will run all the benchmarks in fast mode (running each function once).

You can select just the benchmark you have written using the --bench option

shell asv run --python=same --quick --show-stderr --dry-run --bench time_my_benchmark

Running benchmarks against a local commit

Say you have a local clone of astropy, and you would like to run benchmarks against your local changes. To do this, edit asv.conf.json to switch the repo entry from the upstream repository to your local repository:

diff { "version": 1, "project": "astropy", "project_url": "http://www.astropy.org/", - "repo": "https://github.com/astropy/astropy.git", + "repo": "./astropy/", "install_command": [ "pip install . matplotlib scipy" ], "branches": ["main"], "show_commit_url": "http://github.com/astropy/astropy/commit/", "pythons": ["3.11"], "environment_type": "virtualenv" }

You will then be able to run the benchmarks against a commit in your local repository, e.g.

shell asv run 827f322b^!

Comparing commits

To compare two commits (e.g. the latest upstream commit and a local commit), use asv compare:

shell asv compare 88fbbc33 827f322b

This will show a table with a comparison of the benchmark times for the two commits:

```diff All benchmarks:

   before           after         ratio
 [e8f1432a]       [c378f912]
  • 1.17±0ms 1.69ms 1.44 coordinates.FrameBenchmarks.timeinitarray
  • 388±0.3μs 543μs 1.40 coordinates.FrameBenchmarks.timeinitnodata
  • 932±2μs 1.34ms 1.44 coordinates.FrameBenchmarks.timeinitscalar 1.08s 1.17s 1.08 coordinates.SkyCoordBenchmarks.timeicrstogalacticarray
  • 28.6±0.03ms 43.0ms 1.50 coordinates.SkyCoordBenchmarks.timeicrstogalacticscalar
  • 48.2±7ms 37.4ms 0.78 coordinates.SkyCoordBenchmarks.timeinitarray
  • 2.84±0.01ms 5.22ms 1.84 coordinates.SkyCoordBenchmarks.timeinitscalar
  • 168±2ms 29.5s 175.69 coordinates.SkyCoordBenchmarks.timeiterarray
  • 118±0.2ms 46.4ms 0.39 coordinates.SkyCoordBenchmarks.timereprarray
  • 876±1μs 760μs 0.87 coordinates.SkyCoordBenchmarks.timereprscalar ... ```

Contributing benchmarks

Once you are happy with your benchmark(s), open a pull request to the astropy-benchmarks repository. You do not need to add any result files for the benchmarks - we have machines that automatically do this every night.

Notes to maintainers (outdated)

The main branch in this repository should not contain any results or built website. Results should be added to the results branch, and commits to the results branch trigger a build to the gh-pages branch.

Owner

  • Name: The Astropy Project
  • Login: astropy
  • Kind: organization

GitHub Events

Total
  • Issues event: 5
  • Watch event: 1
  • Delete event: 8
  • Issue comment event: 21
  • Push event: 8
  • Pull request review comment event: 12
  • Pull request review event: 15
  • Pull request event: 18
  • Fork event: 3
  • Create event: 4
Last Year
  • Issues event: 5
  • Watch event: 1
  • Delete event: 8
  • Issue comment event: 21
  • Push event: 8
  • Pull request review comment event: 12
  • Pull request review event: 15
  • Pull request event: 18
  • Fork event: 3
  • Create event: 4

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 156
  • Total Committers: 23
  • Avg Commits per committer: 6.783
  • Development Distribution Score (DDS): 0.615
Past Year
  • Commits: 12
  • Committers: 4
  • Avg Commits per committer: 3.0
  • Development Distribution Score (DDS): 0.583
Top Committers
Name Email Commits
Thomas Robitaille t****e@g****m 60
Pey Lian Lim 2****m 27
Michael Droettboom m****m@g****m 23
Adrian Price-Whelan a****w@g****m 9
Erik Tollerud e****d@g****m 5
Larry Bradley l****y@g****m 5
dependabot[bot] 4****] 4
Clément Robert c****2@p****m 3
Brigitta Sipocz b****z@g****m 2
Michael Mueller m****7@g****m 2
Simon Conseil c****t@s****g 2
Tom Aldcroft t****t@g****m 2
Zach Burnett z****t@g****m 2
Alexander Conley a****y@g****m 1
Christoph Deil D****h@g****m 1
Geert Barentsen g****t@b****e 1
James Noss j****s@s****u 1
Marten van Kerkwijk m****k@a****a 1
Michael Wood-Vasey w****v@p****u 1
Moritz Guenther m****r@g****e 1
Mridul Seth m****l@m****m 1
Nadia Dencheva n****a@g****m 1
Sam Lee o****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 44
  • Total pull requests: 93
  • Average time to close issues: 6 months
  • Average time to close pull requests: about 2 months
  • Total issue authors: 13
  • Total pull request authors: 25
  • Average comments per issue: 2.2
  • Average comments per pull request: 2.35
  • Merged pull requests: 70
  • Bot issues: 0
  • Bot pull requests: 8
Past Year
  • Issues: 5
  • Pull requests: 21
  • Average time to close issues: 1 day
  • Average time to close pull requests: about 16 hours
  • Issue authors: 1
  • Pull request authors: 6
  • Average comments per issue: 1.6
  • Average comments per pull request: 0.76
  • Merged pull requests: 13
  • Bot issues: 0
  • Bot pull requests: 8
Top Authors
Issue Authors
  • pllim (18)
  • astrofrog (8)
  • bsipocz (3)
  • taldcroft (2)
  • eteq (2)
  • jamienoss (1)
  • cdeil (1)
  • MSeifert04 (1)
  • hamogu (1)
  • saimn (1)
  • orbeckst (1)
  • nstarman (1)
  • pv (1)
Pull Request Authors
  • pllim (31)
  • astrofrog (23)
  • dependabot[bot] (9)
  • neutrinoceros (6)
  • larrybradley (5)
  • zacharyburnett (5)
  • adrn (3)
  • nden (2)
  • orionlee (2)
  • bsipocz (2)
  • eteq (2)
  • MridulS (2)
  • mdboom (1)
  • aconley (1)
  • taldcroft (1)
Top Labels
Issue Labels
new-benchmark (14) bug (7) question (2) Upstream fix required (1) enhancement (1)
Pull Request Labels
new-benchmark (15) dependencies (9) bug (7) github_actions (3)

Dependencies

.github/workflows/main.yml actions