Skip to content

Avoid O(n) lookup when creating cuDF Python mixins - #19104

Merged
rapids-bot[bot] merged 1 commit into
NVIDIA:branch-25.08from
mroeschke:ref/mixing/perf
Jun 11, 2025
Merged

Avoid O(n) lookup when creating cuDF Python mixins#19104
rapids-bot[bot] merged 1 commit into
NVIDIA:branch-25.08from
mroeschke:ref/mixing/perf

Conversation

@mroeschke

Copy link
Copy Markdown
Contributor

Description

Minor, but __init_subclass__ would do a O(n) lookup in a loop, operation in dir(cls), where dir(cls) would increase as we setattr.

We can set the original dir(cls), and check each operation against that since we know all added operations will be unique.

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 self-assigned this Jun 5, 2025
@mroeschke
mroeschke requested a review from a team as a code owner June 5, 2025 22:46
@mroeschke
mroeschke requested review from galipremsagar and wence- June 5, 2025 22:46
@mroeschke mroeschke added Python Affects Python cuDF API. improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jun 5, 2025
@GPUtester GPUtester moved this to In Progress in cuDF Python Jun 5, 2025
Comment thread python/cudf/cudf/core/mixins/mixin_factory.py
Comment thread python/cudf/cudf/core/mixins/mixin_factory.py
@mroeschke

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit d956479 into NVIDIA:branch-25.08 Jun 11, 2025
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python Jun 11, 2025
@mroeschke
mroeschke deleted the ref/mixing/perf branch June 11, 2025 21:33
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