Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xarray/tests/test_cftimeindex_resample.py::test_resampler is way too slow #2874

Closed
shoyer opened this issue Apr 7, 2019 · 1 comment
Closed

Comments

@shoyer
Copy link
Member

shoyer commented Apr 7, 2019

Some profiling results from pytest:

$ pytest -k cftime --durations=50
...
============================================= slowest 50 test durations ==============================================
7.92s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-None-right-700T]
7.45s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-None-None-700T]
7.17s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-None-right-700T]
7.12s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-None-None-700T]
7.12s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-right-right-700T]
7.03s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-right-None-700T]
6.88s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-right-None-700T]
6.70s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-right-right-700T]
5.88s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-right-right-12H]
5.69s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-None-None-12H]
5.55s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-None-None-12H]
5.44s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-None-right-12H]
5.44s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-right-None-12H]
5.32s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-None-right-12H]
5.21s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-right-right-12H]
5.08s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-right-None-12H]
1.56s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-31-right-None-700T]
1.36s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-31-right-right-700T]
1.22s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-31-None-right-700T]
1.19s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-24-None-None-700T]
1.16s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-31-None-None-700T]
1.15s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-24-None-right-700T]
1.11s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-24-right-None-700T]
1.09s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-24-right-right-700T]
0.96s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-31-None-None-12H]
0.93s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-31-None-right-12H]
0.93s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-31-right-None-12H]
0.91s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-24-None-None-12H]
0.91s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-31-right-right-12H]
0.89s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-24-right-None-12H]
0.88s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-24-None-right-12H]
0.86s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3Q_AUG-24-right-right-12H]
0.69s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-right-None-8001T]
0.69s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-None-right-8001T]
0.66s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-None-None-8001T]
0.65s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-right-right-8001T]
0.64s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-None-right-8D]
0.62s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-None-right-8D]
0.62s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-None-right-8001T]
0.60s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-None-None-8001T]
0.59s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-right-right-8D]
0.59s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-right-right-8001T]
0.57s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-right-right-8D]
0.57s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-right-None-8001T]
0.38s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[41987T-31-None-None-700T]
0.36s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-None-None-8D]
0.36s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-None-None-8D]
0.34s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-24-right-None-8D]
0.33s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[3AS_JUN-31-right-None-8D]
0.33s call     xarray/tests/test_cftimeindex_resample.py::test_resampler[41987T-31-right-right-700T]

This is a heavily parametrized test, and many of these test cases take 5+ seconds to run! Are there ways we could simplify these tests to make them faster?

On my laptop, this test alone roughly doubles the runtime of our entire test suite, increasing it from about 2 minutes to 4 minutes.

@jwenfai @spencerkclark Any ideas?

@spencerkclark
Copy link
Member

spencerkclark commented Apr 8, 2019

That is way too long. I think #2879 should be a big improvement (all of the tests in test_cftimeindex_resample.py now take shorter time than the longest test listed above).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants