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

Fix performance regression in array transfer performance #3814

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions arkouda/pdarraycreation.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,19 @@ def array(
raise RuntimeError(
"Array exceeds allowed transfer size. Increase ak.client.maxTransferBytes to allow"
)
# Make a copy to avoid error #3757
a = a.copy()
if a.flags["F_CONTIGUOUS"] and not a.flags["OWNDATA"]:
# Make a copy if the array was shallow-transposed (to avoid error #3757)
a_ = a.copy()
else:
a_ = a
# Pack binary array data into a bytes object with a command header
# including the dtype and size. If the server has a different byteorder
# than our numpy array we need to swap to match since the server expects
# native endian bytes
aview = _array_memview(a)
aview = _array_memview(a_)
rep_msg = generic_msg(
cmd=f"array<{a.dtype.name},{ndim}>",
args={"dtype": a.dtype.name, "shape": tuple(a.shape), "seg_string": False},
cmd=f"array<{a_.dtype.name},{ndim}>",
args={"dtype": a_.dtype.name, "shape": tuple(a_.shape), "seg_string": False},
payload=aview,
send_binary=True,
)
Expand Down
Loading