Skip to content

[data] Removing unnecessary data copy in convert_udf_returns_to_numpy#39188

Merged
raulchen merged 4 commits intoray-project:masterfrom
raulchen:reduce-data-copy
Sep 5, 2023
Merged

[data] Removing unnecessary data copy in convert_udf_returns_to_numpy#39188
raulchen merged 4 commits intoray-project:masterfrom
raulchen:reduce-data-copy

Conversation

@raulchen
Copy link
Contributor

@raulchen raulchen commented Aug 31, 2023

Why are these changes needed?

This increases the perf of image_loader_microbenchmark.py by ~10%.

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Hao Chen <chenh1024@gmail.com>
Copy link
Contributor

@c21 c21 left a comment

Choose a reason for hiding this comment

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

Thanks!

else:
storage = pa.concat_arrays([c.storage for c in to_concat])
if len(to_concat) == 1:
storage = to_concat[0].storage
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add a comment for why this is needed, for reader in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turns out that the PyArrow Block copy code path expects this function to copy data. I reverted this change in this PR, as it doesn't impact the final benchmark perf.

This reverts commit 75b7581.

Signed-off-by: Hao Chen <chenh1024@gmail.com>
@raulchen raulchen changed the title [data] Removing unnecessary data copy [data] Removing unnecessary data copy in convert_udf_returns_to_numpy Sep 1, 2023
@raulchen raulchen merged commit a38eb53 into ray-project:master Sep 5, 2023
@raulchen raulchen deleted the reduce-data-copy branch September 5, 2023 18:29
jimthompson5802 pushed a commit to jimthompson5802/ray that referenced this pull request Sep 12, 2023
…ray-project#39188)

---------

Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Jim Thompson <jimthompson5802@gmail.com>
vymao pushed a commit to vymao/ray that referenced this pull request Oct 11, 2023
…ray-project#39188)

---------

Signed-off-by: Hao Chen <chenh1024@gmail.com>
Signed-off-by: Victor <vctr.y.m@example.com>
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.

2 participants