home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 957432870

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
957432870 MDExOlB1bGxSZXF1ZXN0NzAwODYwMzY4 5661 Speed up _mapping_repr 14371165 closed 0     8 2021-08-01T08:44:17Z 2022-08-12T09:07:44Z 2021-08-02T19:45:16Z MEMBER   0 pydata/xarray/pulls/5661

Creating a ordered list for filtering purposes using .items() turns out being rather slow. Use .keys() instead as that doesn't trigger a bunch of dataarray initializations.

  • [x] Passes pre-commit run --all-files

Test case:

```python import numpy as np import xarray as xr

a = np.arange(0, 2000) data_vars = dict() for i in a: data_vars[f"long_variable_name_{i}"] = xr.DataArray( name=f"long_variable_name_{i}", data=np.arange(0, 20), dims=[f"long_coord_name_{i}x"], coords={f"long_coord_name{i}x": np.arange(0, 20) * 2}, ) ds0 = xr.Dataset(data_vars) ds0.attrs = {f"attr{k}": 2 for k in a} ```

Before: python %timeit print(ds0) 14.6 s ± 215 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

After: python %timeit print(ds0) 120 ms ± 2.06 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5661/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 1 row from issues_id in issues_labels
  • 8 rows from issue in issue_comments
Powered by Datasette · Queries took 1.019ms · About: xarray-datasette