Skip to content

Performance regression after 0.24 on DataFrame.add/sub #27835

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

Closed
Naich opened this issue Aug 9, 2019 · 1 comment
Closed

Performance regression after 0.24 on DataFrame.add/sub #27835

Naich opened this issue Aug 9, 2019 · 1 comment
Labels
Duplicate Report Duplicate issue or pull request

Comments

@Naich
Copy link

Naich commented Aug 9, 2019

Code Sample, a copy-pastable example if possible

import pandas as pd
print(pd.__version__)
df = pd.DataFrame(1, index=range(1000), columns=range(1000))

%timeit df.sub(1);
%timeit df.sub(df.mean());
%timeit df - df.mean();
%timeit df.mean();
0.25.0
420 ms ± 6.46 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
390 ms ± 4.96 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
401 ms ± 2.82 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
1.48 ms ± 5.71 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
0.22.0
1.07 ms ± 40.8 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
11.4 ms ± 376 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
11.5 ms ± 291 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
1.64 ms ± 52.7 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)

Problem description

DataFrame.add/sub is a lot slower after pandas upgrade.
I also tested other versions, 0.23.4 is the last version that works normally.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : None
python : 3.6.9.final.0
python-bits : 64
OS : Linux
OS-release : 3.16.35-031635-generic
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL :
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 0.25.0
numpy : 1.16.4
pytz : 2019.1
dateutil : 2.8.0
pip : 19.1.1
setuptools : 41.0.1
Cython : 0.29.12
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 1.1.8
lxml.etree : 4.3.4
html5lib : None
pymysql : 0.9.3
psycopg2 : None
jinja2 : 2.10.1
IPython : 7.1.1
pandas_datareader: None
bs4 : 4.7.1
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.3.4
matplotlib : 3.1.0
numexpr : 2.6.9
odfpy : None
openpyxl : 2.6.2
pandas_gbq : None
pyarrow : 0.11.1
pytables : None
s3fs : None
scipy : 1.3.0
sqlalchemy : 1.3.5
tables : 3.5.2
xarray : None
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.1.8

@TomAugspurger
Copy link
Contributor

Looks like a duplicate of #24990.

We're getting close to fixing this. I think it'll happen for 1.0

@TomAugspurger TomAugspurger added the Duplicate Report Duplicate issue or pull request label Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants