Skip to content

PERF: rolling std/var x100 slower in current dev version #62694

@yolking

Description

@yolking

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

import pandas as pd
import numpy as np
import time
import platform

n = 2_000_000
window = 500
s = pd.Series(np.random.randn(n), name="x")

_ = s.rolling(window).std()

t0 = time.perf_counter()
_ = s.rolling(window).std()
t = time.perf_counter() - t0

print(f"Rolling std({window}) on {n:,} rows took {t:.4f} s")

Running on current dev (installed by pip install git+https://github.com/pandas-dev/pandas.git
or pip install --pre --extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple pandas)
I get

Rolling std(500) on 2,000,000 rows took 4.3563 s

Installed Versions

INSTALLED VERSIONS

commit : c4449f0
python : 3.14.0
python-bits : 64
OS : Windows
OS-release : 2022Server
Version : 10.0.22631
machine : AMD64
processor : AMD64 Family 25 Model 24 Stepping 1, AuthenticAMD
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252

pandas : 3.0.0.dev0+2533.gc4449f0e1c
numpy : 2.3.3
dateutil : 2.9.0.post0
pip : 25.2
Cython : None
sphinx : None
IPython : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : None
lxml.etree : None
matplotlib : 3.10.6
numba : None
numexpr : None
odfpy : None
openpyxl : None
psycopg2 : None
pymysql : None
pyarrow : None
pyiceberg : None
pyreadstat : None
pytest : None
python-calamine : None
pytz : 2025.2
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
qtpy : None
pyqt5 : None

Prior Performance

Running on pandas 2.3.3 I get

Rolling std(500) on 2,000,000 rows took 0.0377 s

Results on python 3.12 and 3.13 are same

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssue that has not been reviewed by a pandas team memberPerformanceMemory or execution speed performanceWindowrolling, ewma, expanding

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions