home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 520048334

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/3054#issuecomment-520048334 https://api.github.com/repos/pydata/xarray/issues/3054 520048334 MDEyOklzc3VlQ29tbWVudDUyMDA0ODMzNA== 6213168 2019-08-09T20:10:29Z 2019-08-09T20:29:23Z MEMBER

Mh. Actually it looks like ndarray.flat is the fastest way to iterate over numpy. Still considerably slower than a CPython iterator though

```python import numpy

N = 1000000 a = numpy.arange(N)

def exhaust(it): for _ in it: pass

%timeit exhaust(a) 24.8 ms ± 723 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) %timeit exhaust(a.flat) 20.4 ms ± 701 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) %timeit exhaust(a.tolist()) 27.2 ms ± 1.16 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) %timeit exhaust(range(N)) 10.5 ms ± 234 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) ```

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