Skip to content
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

NumPy implementation of unravel(). #12

Merged
merged 7 commits into from
Feb 17, 2024
Merged

NumPy implementation of unravel(). #12

merged 7 commits into from
Feb 17, 2024

Conversation

alxmrs
Copy link
Owner

@alxmrs alxmrs commented Feb 15, 2024

Here, I put forth a significantly faster implementation of unravel that uses an unbounded amount of memory. Since we use NumPy operations, everything is much faster (due to vectorization).

We won't have to worry about unbounded memory when converting to Dask dataframes, since we default to use Xarray chunks.

This answers some questions in #8.

… flamegraph, it looks like this is much more performant than before!
@alxmrs alxmrs changed the title [Draft] NumPy implementation of unravel(). NumPy implementation of unravel(). Feb 15, 2024
@alxmrs
Copy link
Owner Author

alxmrs commented Feb 15, 2024

@cisaacstern Check this out, I think qarray is getting interesting!

qarray/core.py Outdated Show resolved Hide resolved
coords = np.empty((N, DD))
for i, c in enumerate(itertools.product(*[ds.coords[v] for v in dim_keys])):
coord = np.array(c)
coords[i] = coord
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omit the loop and just create the array.

qarray/df.py Outdated Show resolved Hide resolved
@alxmrs alxmrs merged commit cdc5d41 into main Feb 17, 2024
@alxmrs alxmrs deleted the np-unravel branch March 10, 2024 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant