Skip to content

[PERF]: Use __new__ to directly instantiate cdef classes#1648

Closed
mdboom wants to merge 1 commit intoNVIDIA:mainfrom
mdboom:use-new
Closed

[PERF]: Use __new__ to directly instantiate cdef classes#1648
mdboom wants to merge 1 commit intoNVIDIA:mainfrom
mdboom:use-new

Conversation

@mdboom
Copy link
Contributor

@mdboom mdboom commented Feb 18, 2026

Fixes #1643. This follows the advice in the Cython docs for directly instantiating a cdef class Python object. This avoids a dictionary lookup and a Python-calling-convention call to the constructor.

@mdboom mdboom self-assigned this Feb 18, 2026
@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Feb 18, 2026

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

Copy link
Contributor

@cpcloud cpcloud left a comment

Choose a reason for hiding this comment

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

... it's so ugly :(

@mdboom
Copy link
Contributor Author

mdboom commented Feb 18, 2026

/ok to test

@github-actions
Copy link

@mdboom mdboom marked this pull request as draft February 18, 2026 20:11
@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Feb 18, 2026

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@mdboom mdboom closed this Feb 18, 2026
@leofang
Copy link
Member

leofang commented Feb 18, 2026

Q: We don't want this anymore? Seems fine to me.

@leofang
Copy link
Member

leofang commented Feb 18, 2026

Ah, I see #1643 (comment).

github-actions bot pushed a commit that referenced this pull request Feb 19, 2026
Removed preview folders for the following PRs:
- PR #1218
- PR #1606
- PR #1623
- PR #1648
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.

[PERF] Construction of known cdef classes can go through __new__

3 participants