Skip to content

Add datatree repr asv #10214

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

Merged
merged 1 commit into from
Apr 9, 2025
Merged
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
19 changes: 19 additions & 0 deletions asv_bench/benchmarks/repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@ def time_repr_html(self):
self.ds._repr_html_()


class ReprDataTree:
def setup(self):
# construct a datatree with 500 nodes
number_of_files = 20
number_of_groups = 25
tree_dict = {}
for f in range(number_of_files):
for g in range(number_of_groups):
tree_dict[f"file_{f}/group_{g}"] = xr.Dataset({"g": f * g})

self.dt = xr.DataTree.from_dict(tree_dict)

def time_repr(self):
repr(self.dt)

def time_repr_html(self):
self.dt._repr_html_()


class ReprMultiIndex:
def setup(self):
index = pd.MultiIndex.from_product(
Expand Down
Loading