Skip to content

[mypyc] Speed up implicit __ne__ method #19759

Merged
JukkaL merged 5 commits into
masterfrom
mypyc-implicit-ne
Aug 29, 2025
Merged

[mypyc] Speed up implicit __ne__ method #19759
JukkaL merged 5 commits into
masterfrom
mypyc-implicit-ne

Conversation

@JukkaL

@JukkaL JukkaL commented Aug 29, 2025

Copy link
Copy Markdown
Collaborator

Avoid the use of PyObject_Not if __eq__ returns a boolean (which is common). Also skip incref on the bool/bit result on 3.12+, since the object is immortal.

This speeds up a microbenchmark that repeatedly does != operations by 20%.

@JukkaL
JukkaL merged commit f83ec9f into master Aug 29, 2025
13 checks passed
@JukkaL
JukkaL deleted the mypyc-implicit-ne branch August 29, 2025 14:53
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