Skip to content

PERF: Performance Discrepancy in MultiIndex Creation with and without Timezones #57147

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
2 of 3 tasks
HarryCollins2 opened this issue Jan 30, 2024 · 2 comments
Closed
2 of 3 tasks
Labels
Needs Triage Issue that has not been reviewed by a pandas team member Performance Memory or execution speed performance

Comments

@HarryCollins2
Copy link

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this issue exists on the latest version of pandas.

  • I have confirmed this issue exists on the main branch of pandas.

Reproducible Example

Description:

Hey there,

I stumbled upon a bit of a head-scratcher while creating MultiIndexes. There's quite a performance difference when we create MultiIndexes with timezones compared to without.

# T
%time multi_idx_no_tz = pd.MultiIndex.from_arrays([np.repeat(pd.Timestamp('2019-01-01 00:00:00', tz=None), n), range(n)])
%time multi_idx_with_tz = pd.MultiIndex.from_arrays([np.repeat(pd.Timestamp('2019-01-01 00:00:00', tz='UTC'), n), range(n)])

CPU times: user 1.1 s, sys: 48.6 ms, total: 1.15 s
Wall time: 1.16 s
CPU times: user 349 ms, sys: 27 ms, total: 376 ms
Wall time: 379 ms

I am curious about the performance difference here and would appreciate your insights.

Thank you!

Installed Versions

INSTALLED VERSIONS

commit : a671b5a
python : 3.10.6.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19045
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 13, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.936

pandas : 2.1.4
numpy : 1.26.3
pytz : 2023.4
dateutil : 2.8.2
setuptools : 65.4.1
pip : 22.2.2
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.3
IPython : 8.20.0
pandas_datareader : None
bs4 : 4.12.3
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.6.0
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : 0.9.0
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.4
qtpy : None
pyqt5 : None

Prior Performance

No response

@HarryCollins2 HarryCollins2 added Needs Triage Issue that has not been reviewed by a pandas team member Performance Memory or execution speed performance labels Jan 30, 2024
@jrmylow
Copy link
Contributor

jrmylow commented Jan 30, 2024

Hi, suspect it's the same root cause as #56860

My write up of this issue is here: #56860 (comment), unfortunately haven't gotten around to a fix yet

@mroeschke
Copy link
Member

Thanks for the report. Closing as a duplicate of #56860

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Triage Issue that has not been reviewed by a pandas team member Performance Memory or execution speed performance
Projects
None yet
Development

No branches or pull requests

3 participants