Skip to content

Commit 54ee8b8

Browse files
committed
BENCH: Adding DataFrame plotting benchmarks for large datasets
1 parent 25e6462 commit 54ee8b8

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

asv_bench/benchmarks/plotting.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,42 @@ def time_get_plot_backend_fallback(self):
161161
_get_plot_backend("pandas_dummy_backend")
162162

163163

164-
from .pandas_vb_common import setup # noqa: F401 isort:skip
164+
class DataFramePlottingLarge:
165+
"""
166+
Benchmarks for DataFrame plotting performance with large datasets
167+
Addresses performance issues like #61398 and #61532
168+
"""
169+
params = [
170+
[(1000, 10), (1000, 50), (1000, 100), (5000, 20), (10000, 10)],
171+
[True, False] # DatetimeIndex or not
172+
]
173+
param_names = ["size", "datetime_index"]
174+
175+
def setup(self, size, datetime_index):
176+
rows, cols = size
177+
178+
if datetime_index:
179+
# Create DataFrame with DatetimeIndex (problematic case #61398)
180+
idx = date_range("2020-01-01", periods=rows, freq="min")
181+
self.df = DataFrame(
182+
np.random.randn(rows, cols),
183+
index=idx,
184+
columns=[f"col_{i}" for i in range(cols)]
185+
)
186+
else:
187+
# Regular integer index for comparison
188+
self.df = DataFrame(
189+
np.random.randn(rows, cols),
190+
columns=[f"col_{i}" for i in range(cols)]
191+
)
192+
193+
def time_plot_large_dataframe(self, size, datetime_index):
194+
"""Benchmark plotting large DataFrames (bottleneck #61398/#61532)"""
195+
self.df.plot()
196+
197+
def time_plot_large_dataframe_single_column(self, size, datetime_index):
198+
"""Baseline: plotting single column for comparison"""
199+
self.df.iloc[:, 0].plot()
200+
201+
202+
from .pandas_vb_common import setup # noqa isort:skip

0 commit comments

Comments
 (0)