Skip to content

ENH: Adding DataFrame plotting benchmarks for large datasets #61546

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion asv_bench/benchmarks/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,45 @@ def time_get_plot_backend_fallback(self):
_get_plot_backend("pandas_dummy_backend")


from .pandas_vb_common import setup # noqa: F401 isort:skip
class DataFramePlottingLarge:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what differentiates this from FramePlotting is that these are wide. Can you rename this class to FramePlottingWide.

"""
Benchmarks for DataFrame plotting performance with large datasets
Addresses performance issues like #61398 and #61532
"""
params = [
[(1000, 10), (1000, 50), (1000, 100), (5000, 20), (10000, 10)],
[True, False] # DatetimeIndex or not
Comment on lines +170 to +171
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is too many cases. Can you just do [(1000, 100)]

]
param_names = ["size", "datetime_index"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename size -> shape.


def setup(self, size, datetime_index):
rows, cols = size

if datetime_index:
# Create DataFrame with DatetimeIndex (problematic case #61398)
idx = date_range("2020-01-01", periods=rows, freq="min")
self.df = DataFrame(
np.random.randn(rows, cols),
index=idx,
columns=[f"col_{i}" for i in range(cols)]
)
else:
# Regular integer index for comparison
self.df = DataFrame(
np.random.randn(rows, cols),
columns=[f"col_{i}" for i in range(cols)]
)

# Pre-select single column for baseline comparison
self.single_column = self.df.iloc[:, 0]

def time_plot_large_dataframe(self, size, datetime_index):
"""Benchmark plotting large DataFrames (bottleneck #61398/#61532)"""
self.df.plot()

def time_plot_large_dataframe_single_column(self, size, datetime_index):
"""Baseline: plotting single column for comparison"""
self.single_column.plot()


from .pandas_vb_common import setup # noqa isort:skip
Loading