KEMBAR78
[mypyc] Speed up implicit __ne__ method by JukkaL · Pull Request #19759 · python/mypy · GitHub
Skip to content

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Aug 29, 2025

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