issues: 1423312198
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1423312198 | PR_kwDOAMm_X85Bi3Dp | 7221 | Remove debugging slow assert statement | 90008 | closed | 0 | 13 | 2022-10-26T01:43:08Z | 2022-10-28T02:49:44Z | 2022-10-28T02:49:44Z | CONTRIBUTOR | 0 | pydata/xarray/pulls/7221 | We've been trying to understand why our code is slow. One part is that we use xarray.Datasets almost like dictionaries for our data. The following code is quite common for us
However, through benchmarks, it became obvious that the With this merge request:
```python from tqdm import tqdm import xarray as xr from time import perf_counter import numpy as np N = 1000 Everybody is lazy loading now, so lets force modules to get instantiateddummy_dataset = xr.Dataset() dummy_dataset['a'] = 1 dummy_dataset['b'] = 1 del dummy_dataset time_elapsed = np.zeros(N) dataset = xr.Dataset() for i in tqdm(range(N)): time_start = perf_counter() dataset[f"var{i}"] = i time_end = perf_counter() time_elapsed[i] = time_end - time_start %%from matplotlib import pyplot as plt plt.plot(np.arange(N), time_elapsed * 1E3, label='Time to add one variable') plt.xlabel("Number of existing variables") plt.ylabel("Time to add a variables (ms)") plt.ylim([0, 50]) plt.grid(True) ```
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/7221/reactions", "total_count": 2, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 2, "eyes": 0 } |
13221727 | pull |