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

Improve performance of Series.to_numpy/to_cupy #15792

Merged
merged 3 commits into from
May 21, 2024

Conversation

mroeschke
Copy link
Contributor

Description

xref #11648

Essentially refactors Frame._to_array to short circuit some checks for a Frame with 1 column or ndim == 1

In [1]: import cudf

In [2]: s = cudf.Series(range(10000))

In [3]: %timeit s.to_cupy()
252 µs ± 3.47 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)  # PR

419 µs ± 2.21 µs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)  # branch 24.06

I needed to add Frame.ndim which will raise a NotImplementedError (until Frame actually becomes an ABC)

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@mroeschke mroeschke added Python Affects Python cuDF API. improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels May 21, 2024
@mroeschke mroeschke requested a review from a team as a code owner May 21, 2024 00:06
@mroeschke mroeschke requested review from vyasr and isVoid May 21, 2024 00:06
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

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

Just one small fix.

python/cudf/cudf/core/frame.py Outdated Show resolved Hide resolved
@galipremsagar
Copy link
Contributor

/merge

@rapids-bot rapids-bot bot merged commit 60d5717 into rapidsai:branch-24.06 May 21, 2024
70 checks passed
@mroeschke mroeschke deleted the perf/to_array branch May 21, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants