Skip to content

Commit 4e5aa02

Browse files
committed
TST: add benchmark
1 parent c94cbd5 commit 4e5aa02

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

asv_bench/benchmarks/rolling.py

+22
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,26 @@ def peakmem_fixed(self):
165165
self.roll.max()
166166

167167

168+
class ForwardWindowMethods:
169+
params = (
170+
["DataFrame", "Series"],
171+
[10, 1000],
172+
["int", "float"],
173+
["median", "mean", "max", "min", "kurt", "sum"],
174+
)
175+
param_names = ["constructor", "window_size", "dtype", "method"]
176+
177+
def setup(self):
178+
N = 10 ** 5
179+
arr = np.random.random(N).astype(dtype)
180+
indexer = pd.api.indexers.FixedForwardWindowIndexer(window_size)
181+
self.roll = getattr(pd, constructor)(arr).rolling(window=indexer)
182+
183+
def time_rolling(self, constructor, window, dtype, method):
184+
getattr(self.roll, method)()
185+
186+
def peakmem_rolling(self, constructor, window, dtype, method):
187+
getattr(self.roll, method)()
188+
189+
168190
from .pandas_vb_common import setup # noqa: F401 isort:skip

0 commit comments

Comments
 (0)