home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1291948502

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/7221#issuecomment-1291948502 https://api.github.com/repos/pydata/xarray/issues/7221 1291948502 IC_kwDOAMm_X85NAZHW 90008 2022-10-26T12:19:49Z 2022-10-26T12:23:46Z CONTRIBUTOR

I know it is not comparable, but I was really curious what "dictionary insertion" costs, in order to be able to understand if my comparisons were fair:

code ```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 instantiated dummy_dataset = xr.Dataset() dummy_dataset['a'] = 1 dummy_dataset['b'] = 1 del dummy_dataset time_elapsed = np.zeros(N) # dataset = xr.Dataset() dataset = {} for i in tqdm(range(N)): # for i in 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 * 1E6, label='Time to add one variable') plt.xlabel("Number of existing variables") plt.ylabel("Time to add a variables (us)") plt.ylim([0, 10]) plt.title("Dictionary insertion") plt.grid(True) ```

I think xarray gives me 3 order of magnitude of "thinking" benefit, so I'll take it! python --version Python 3.9.13

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1423312198
Powered by Datasette · Queries took 0.972ms · About: xarray-datasette