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

Fix large concatenations and stacks. #51

Merged
merged 2 commits into from Dec 28, 2017

Conversation

Projects
None yet
2 participants
@hameerabbasi
Collaborator

hameerabbasi commented Dec 28, 2017

Addresses #32.

@hameerabbasi hameerabbasi force-pushed the hameerabbasi:fix-large-concat-stack branch from cf0c89f to 1f04bd6 Dec 28, 2017

@hameerabbasi hameerabbasi force-pushed the hameerabbasi:fix-large-concat-stack branch from 1f04bd6 to 51a1360 Dec 28, 2017

@mrocklin

This looks good to me. I had a small question, but please feel free to merge at will.

data = np.concatenate([x.data for x in arrays])
coords = np.concatenate([x.coords for x in arrays], axis=1)
coords = np.concatenate([x.coords for x in arrays], axis=1).astype(coords_dtype)

This comment has been minimized.

@mrocklin

mrocklin Dec 28, 2017

Collaborator

Is it better to call .astype(...) before concatenation on all of arrays or after as is done here?

This comment has been minimized.

@hameerabbasi

hameerabbasi Dec 28, 2017

Collaborator

I would think after. Because it would be applied to a bigger array and thus the overhead would be small. Memory would be better, too, as we are just passing already-allocated arrays to concatenate, otherwise we'd have to allocate for each temp array.

Incidentally, astype just returns the original array if it is already the correct dtype.

@hameerabbasi hameerabbasi merged commit 9988aec into pydata:master Dec 28, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@hameerabbasi hameerabbasi deleted the hameerabbasi:fix-large-concat-stack branch Dec 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment