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

PERF: Period plotting performance #24308

Merged
merged 5 commits into from
Dec 17, 2018

Conversation

TomAugspurger
Copy link
Contributor

@TomAugspurger TomAugspurger commented Dec 16, 2018

Setup

In [3]: N = 2000
   ...: M = 5
   ...: idx = date_range('1/1/1975', periods=N)
   ...: df = DataFrame(np.random.randn(N, M), index=idx)

0.23.4:

In [3]: %time df.plot()
CPU times: user 274 ms, sys: 66.7 ms, total: 340 ms
Wall time: 377 ms
Out[3]: <matplotlib.axes._subplots.AxesSubplot at 0x11eda6128>

HEAD:

In [4]: %time df.plot()
CPU times: user 141 ms, sys: 32.6 ms, total: 173 ms
Wall time: 194 ms
Out[4]: <matplotlib.axes._subplots.AxesSubplot at 0x11550a5f8>

Closes #24304

Setup

```python
In [3]: N = 2000
   ...: M = 5
   ...: idx = date_range('1/1/1975', periods=N)
   ...: df = DataFrame(np.random.randn(N, M), index=idx)
```

Master:

```python
In [3]: %time df.plot()
CPU times: user 274 ms, sys: 66.7 ms, total: 340 ms
Wall time: 377 ms
Out[3]: <matplotlib.axes._subplots.AxesSubplot at 0x11eda6128>
```

HEAD:

```python
In [4]: %time df.plot()
CPU times: user 141 ms, sys: 32.6 ms, total: 173 ms
Wall time: 194 ms
Out[4]: <matplotlib.axes._subplots.AxesSubplot at 0x11550a5f8>
```
@pep8speaks
Copy link

Hello @TomAugspurger! Thanks for submitting the PR.

@TomAugspurger TomAugspurger added this to the 0.24.0 milestone Dec 16, 2018
@TomAugspurger TomAugspurger added Visualization plotting Performance Memory or execution speed performance labels Dec 16, 2018
@TomAugspurger
Copy link
Contributor Author

cc @jorisvandenbossche.

The slowdown was operating element wise on an ndarray of Period objects. The array was coming from matplotlib.

I'm not sure if we always got the ndarray of Period objects and previously handled them differently, or if something changed on MPL's end to convert what we're giving them (PeriodIndex) to an ndarray.

@codecov
Copy link

codecov bot commented Dec 16, 2018

Codecov Report

Merging #24308 into master will increase coverage by <.01%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24308      +/-   ##
==========================================
+ Coverage   92.28%   92.28%   +<.01%     
==========================================
  Files         162      162              
  Lines       51827    51829       +2     
==========================================
+ Hits        47827    47829       +2     
  Misses       4000     4000
Flag Coverage Δ
#multiple 90.68% <66.66%> (ø) ⬆️
#single 43.01% <33.33%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/plotting/_converter.py 63.78% <66.66%> (+0.1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41681c8...3f6903b. Read the comment docs.

@codecov
Copy link

codecov bot commented Dec 16, 2018

Codecov Report

Merging #24308 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #24308      +/-   ##
==========================================
+ Coverage   92.28%   92.28%   +<.01%     
==========================================
  Files         162      162              
  Lines       51827    51831       +4     
==========================================
+ Hits        47827    47833       +6     
+ Misses       4000     3998       -2
Flag Coverage Δ
#multiple 90.69% <100%> (ø) ⬆️
#single 43% <20%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/plotting/_converter.py 63.82% <100%> (+0.14%) ⬆️
pandas/core/indexes/period.py 93.06% <0%> (ø) ⬆️
pandas/core/arrays/datetimelike.py 96.44% <0%> (ø) ⬆️
pandas/core/arrays/period.py 98.5% <0%> (+0.01%) ⬆️
pandas/util/testing.py 87.58% <0%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41681c8...bec9d8e. Read the comment docs.

@jreback
Copy link
Contributor

jreback commented Dec 17, 2018

lgtm.

@TomAugspurger TomAugspurger merged commit 6077b88 into pandas-dev:master Dec 17, 2018
@TomAugspurger TomAugspurger deleted the period-plotting-perf branch December 17, 2018 13:57
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
* PERF: Period plotting performance

Setup

```python
In [3]: N = 2000
   ...: M = 5
   ...: idx = date_range('1/1/1975', periods=N)
   ...: df = DataFrame(np.random.randn(N, M), index=idx)
```

Master:

```python
In [3]: %time df.plot()
CPU times: user 274 ms, sys: 66.7 ms, total: 340 ms
Wall time: 377 ms
Out[3]: <matplotlib.axes._subplots.AxesSubplot at 0x11eda6128>
```

HEAD:

```python
In [4]: %time df.plot()
CPU times: user 141 ms, sys: 32.6 ms, total: 173 ms
Wall time: 194 ms
Out[4]: <matplotlib.axes._subplots.AxesSubplot at 0x11550a5f8>
```
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
* PERF: Period plotting performance

Setup

```python
In [3]: N = 2000
   ...: M = 5
   ...: idx = date_range('1/1/1975', periods=N)
   ...: df = DataFrame(np.random.randn(N, M), index=idx)
```

Master:

```python
In [3]: %time df.plot()
CPU times: user 274 ms, sys: 66.7 ms, total: 340 ms
Wall time: 377 ms
Out[3]: <matplotlib.axes._subplots.AxesSubplot at 0x11eda6128>
```

HEAD:

```python
In [4]: %time df.plot()
CPU times: user 141 ms, sys: 32.6 ms, total: 173 ms
Wall time: 194 ms
Out[4]: <matplotlib.axes._subplots.AxesSubplot at 0x11550a5f8>
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance Memory or execution speed performance Visualization plotting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants